Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure CLI by

I have a clojure command line app that is invoked with -X. One of the conveniences is to allow "-" as a value which means to read from stdin. Currently, the data formats allowed are JSON and edn. This used to work, but now gives an error for non edn data:

Execution error at clojure.run.exec/read-args-stdin (exec.clj:152).
Invalid token: :

Here's an example usage:
https://github.com/phronmophobic/viscous

cat data.json | clojure -X:viscous :json-file -

I was able to find the commit where this changed, but this behavior doesn't seem to be documented anywhere (although it is very difficult to search for "-").

1 Answer

0 votes
by

Sorry, this usage is not going to work now as the clj tool itself uses - to accept args from stdin now as part of -X handling.

You could still use cat data.json | clojure -X:viscous '{:json-file -}' with the trailing map support.

...