Fork me on GitHub
#tools-deps
<
2022-02-16
>
cjsauer02:02:15

@seancorfield nice. I went with the stdin approach given that JSON is going to be nye impossible to trust as a bash arg.

borkdude08:02:23

@cjsauer In bash’s defence, it should work fine when passing the arg as JSON to a -M -m invocation. The extra quoting required by the EDN parsing of -X is what makes this hard. In Clojure CLI’s defense, it can make other things easy ;-).

borkdude08:02:21

Perhaps the clojure CLI can have some convention to prevent the argument from being parsed as EDN. E.g.:

clojure -X foo/bar :foo 1 :bar @$(.. some json here ...)
An @ isn't valid in EDN anyway and it's just one character to check to see if the arg must be handled as a literal string instead.

Alex Miller (Clojure team)14:02:06

you know where to make requests... :)

borkdude14:02:02

Before making requests, hearing a firm :face_vomiting: , no, or such can save me time ;)

borkdude14:02:46

But a "hmm, not a bad idea, will consider, could you make an ask" will be enough for me to create one :)

borkdude14:02:53

I'll take your reply as the latter.

borkdude14:02:54

I would be super happy if this got addressed!

lread14:02:34

Yeah, like most folks, I too prefer to ping on Slack for a :face_vomiting: or facepalm reaction before investing time in crafting a more formal issue or request.

borkdude16:02:32

I may have found a nicer convention as the leading character:

$ clojure -X foo/bar :foo /dude :bar '"dude"' ;;=> (foo/bar {:foo "dude" :bar "dude"})
A leading slash. Normally this would result into an invalid symbol (or something else invalid) when reading EDN, so it would probably not be breaking anything. It's kind of irrelevant if we go with / or @ but since @ in command line args often denotes reading a file's contents, maybe it's better to reserve that one for later.

borkdude16:02:16

I'm going to try both on Windows, to see if it's going to behave correctly

Alex Miller (Clojure team)16:02:43

can you put suggestions on the ask question please?

borkdude16:02:25

Just experimenting, I will paste the outcome in the issue. After trying bash, cmd.exe and powershell, I found that / may work better than @ since @ seems to not play well in powershell.

borkdude16:02:07

Issue updated.