Fork me on GitHub

I've noticed that, when a :parse-fn throws an exception, outputs the full exception, rather than just the message.

> lacinia-timing -f xyz
lacinia-timing [OPTIONS] [INPUT-FILE]

Reads JSON output from a Lacinia GraphQL query and summarizes the timing.

INPUT-FILE may be "-" to read from standard input.
  -f, --filter MS  Remove timings with duration less than specified value
  -h, --help       This command summary

  Error while parsing option "-f xyz": <>:228:28: Eval error: strconv.Atoi: parsing "xyz": invalid syntax
  global /Users/hlship/workspaces/walmart/cph-tools/lacinia-timing:190:1
  lacinia-timing/command /Users/hlship/workspaces/walmart/cph-tools/lacinia-timing:175:52 <>:545:23 <>:271:9
  core/reduce <joker.core>:740:17
  f <>:274:35 <>:248:9 <>:228:28

👍 4

Not sure whether this is relevant, and I haven't looked into whether it's truly practical, but: I'd like to see Joker use the underlying Go error type (the panic/recover mechanism) more directly, rather than stringizing back and forth as it seems to do right now.


Also, as this Slack channel isn't archived anywhere accessible (that's not funded), maybe turn this and your other wish-list items into Issues at


Wish list for Joker: - Ability to send multiple HTTP requests in parallel - Easy way to assemble a series of OS commands that pipe into each other (e.g., os/exec on steroids) - A few missing math functions, like floor and round

👍 4

Submitted which (among other things) adds floor and ceil. Might add more (such as round) later as I go through the math package in Go.


Just did a bunch more, including round. That PR doesn't add any of the trig nor Bessel functions, nor the MAX/MIN constants. Not sure whether anyone will want any of those, but they're all easy (if a tad tedious) to add.


Note that, if you want to do any more of these yourself, they're usually fairly easy. But the PR includes changes to auto-generated files (named a_*.go), which you should ignore when reviewing such changesets.


The OS piping thing is pretty important IMO. Having Joker script to orchestrate things, but let Unix power tools do the actual work is very sweet. Right now, you kind of have to run each command individually and supply input and capture output as complete strings (though Roman added a little to that recently).

👍 4

Something like:

(let [result (os/pipe
               [["jq" {:args ["-C" url]}]
                ["gron" {:args "-c"}]

👍 4

That would be so cool, IMO. Worth an issue (as I think your others are):


How is this different from (joker.os/sh "bash" "-c" "jq ... | gron ... | less ...")? If you don't do anything with stdin/stdout and just want to pipe data through several tool it probably makes sense to use standard bash pipe functionality...


And I don't want to go overboard on reusable libraries or some kind of packaging system BUT it would be nice if, when a Joker script is executed, it was possible to require supporting libraries that were in the same directory as the script (after symbolic links are expanded). So my run-this-command and run-that-command joker scripts could share a few functions in a shared.joker file in the same directory. Something along those lines.

👍 4

This is already possible:

(ns orders
  (:require [lib.orders]
            [ :as cli]))
(ns lib.orders)
<library functions>


Well, I guess lib.orders is under the lib directory, but based on the namespace, that is to be expected.


That does work when using joker my-script.joke but doesn't when running my-script (that has #!/usr/bin/env joker).


Anything we can do for that case?


hm, there should not be any difference. I'll take a look.


I just checked and it works fine in both cases. Can you send me a zip of the project that's not working for you?


Ok, I'll double check that it's failing and put together a sample project.


I'm not sure why it seemed broken yesterday; user failure. I eventually found one minor case of failure, but it's not a big deal.