borkdude / jet

CLI to transform between JSON, EDN, YAML and Transit using Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Long options with '=' are not parsed

bnii opened this issue · comments

commented

It seems the long-form command-line options don't work in the --option=value way, only as --option value.

Thanks for this tool!

$ echo '{"a": 1}' | jet --from json
{"a" 1}
$ echo '{"a": 1}' | jet --from=json
Exception in thread "main" clojure.lang.EdnReader$ReaderException: java.lang.RuntimeException: Invalid token: :
        at clojure.lang.EdnReader.read(EdnReader.java:180)
        at clojure.lang.EdnReader.read(EdnReader.java:111)
        at clojure.edn$read.invokeStatic(edn.clj:35)
        at jet.formats$parse_edn.invokeStatic(formats.clj:29)
        at jet.main$_main$fn__10629.invoke(main.clj:114)
        at jet.main$_main.invokeStatic(main.clj:121)
        at jet.main$_main.doInvoke(main.clj:97)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at jet.main.main(Unknown Source)
Caused by: java.lang.RuntimeException: Invalid token: :
        at clojure.lang.Util.runtimeException(Util.java:221)
        at clojure.lang.EdnReader.interpretToken(EdnReader.java:285)
        at clojure.lang.EdnReader.read(EdnReader.java:171)
        at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:766)
        at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:680)
        at clojure.lang.EdnReader.read(EdnReader.java:145)
        ... 8 more

Perhaps we should just use clojure.tools.cli which will enable this. @dotemacs perhaps you are interested in looking at this?

Thanks for the honourable mention :) but I'm more of a fan of the short command line options.

Let me think on it.

Thanks

I don't necessarily think we should support this unless there is some strong push from the community.

I don't necessarily think we should support this unless there is some strong push from the community.

I agree with this.

commented

I don't necessarily think we should support this

you mean it would be just a marginal improvement or it is actually not right for some reason?

Marginal improvement. Personally I've never felt the need for this.

Babashka CLI now support parsing this style of invocation:

https://github.com/babashka/cli

We could try to switch to that (and hope nothing else breaks).