Fork me on GitHub
#tools-deps
<
2018-03-14
>
jebberjeb03:03:44

I’ve just been doing $> JAVA_OPTS="-Dclojure..." clj. Same for lein

jebberjeb03:03:34

My thinking was that it’s nice because it doesn’t depend on how a particular thing handles command line args?

dominicm07:03:43

I didn't know that worked for clj, neat.

niclasnilsson11:03:18

I want to get these types of things working, and I think I’ve tried quoting and escaping the things after clj in all ways possible, but I bet there is a way I haven’t tried, since I can’t get it to work:

#!/usr/bin/env clj -Sdeps '{:deps {clj-time {:mvn/version "0.14.2"}}}'
 
(require '[clj-time.core :as t])
(println (str "Time is now " (t/now)))
I either get a "Error building classpath. Don't know how to create ISeq from: clojure.lang.Symbol" or a "Error while parsing option "--config-data {:deps": java.lang.RuntimeException: EOF while reading" for a combinations that I’ve tried. I bet someone knows how to do this properly?

dominicm12:03:58

@niclasnilsson what OS are you on? That won't work for Linux.

niclasnilsson12:03:32

Do you mean like “there is no way to make it work”?

dominicm12:03:34

There's a limitation on how shebangs are read. It doesn't apply to mac though. You may find it works if you don't use env

niclasnilsson13:03:48

Ah, ok. Will try again then. Thanks!

seancorfield16:03:45

Also: try using , instead of space in the deps string.

dominicm16:03:37

@seancorfield Yes, I think you might have the right of it there. ' doesn't have have the same effect in shebangs as on the shell.

seancorfield17:03:43

Confirmed that the following works @niclasnilsson

(! 622)-> ./time.sh 
Time is now 2018-03-14T17:09:15.652Z

Wed Mar 14 10:09:15
(sean)-(jobs:0)-(~/clojure/bin)
(! 623)-> cat time.sh 
#!/usr/bin/env clj -Sdeps {:deps,{clj-time,{:mvn/version,"0.14.2"}}}
 
(require '[clj-time.core :as t])
(println (str "Time is now " (t/now)))
On macOS

dominicm19:03:50

I didn't know BSD did it right too.

niclasnilsson17:03:11

Ah… I wasn’t even close to try that combination. Neat, thanks, @seancorfield!

niclasnilsson17:03:27

Will try myself later tonight, when I get back to this.