A way to make scripting doable in clojure(script)

clojure --deps scriptA.clj.deps.edn scriptA.clj
clj --deps scriptA.clj.deps.edn scriptA.clj

If clojure and clj were able to specify path to deps.edn with such an option as --deps, planck could make use of this option through its plk executable. So, both clojure and clojurescript obtain a way to easily edit dependencies for each clojure(script) script.

"exec" "plk" "--deps" "scriptA.clj.deps.edn" "$0" "$@"
(require 'blah)

(println "good night")
1 Like

Not sure I get this? you want to change this in Clj or Planck?

In clj. Planck will just inherit command line arguments from clj because planck uses clojure to do dependency resolution.

You should be able to use -Sdeps "$(cat path/to/file/edn)"


Damn, that is genius.

Unfortunately, -Sdeps "$(cat path/to/file/edn)" suffers from the fact that I have to specify an absolute path to edn if I wanted to call the script anywhere.

I guess it would be better to specify -Sdeps for each dependency.

Where do you want the deps.edn file to come from? The same directory as the shell script itself? Then use:

"$(cat `dirname $0`/deps.edn)"
1 Like

When there are spaces in the path to deps.edn, “$(cat dirname $0/deps.edn)” breaks down.

Maybe wrap dirname $0/deps.edn in double quotes too ?

I tried it. It doesn’t work.

Lots of tooling breaks when there are spaces in filesystem paths – the solution is to not use such paths.

Even on Windows, you can avoid filesystem paths with spaces if you stay outside Windows’ own system folders (and you should).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.