I'm considering writing a deps.edn tool implementation for shadow-cljs. Mostly because clj -Ttools install-latest
makes it easy to install. Comparable to npm install shadow-cljs
, although I have no intention of replacing that. Just offering alternate options.
The part however I'm absolutely not on board with and would like to opt out of is the pre-defined arguments parsing that is done for such tools. Has that been considered?
Tools are all invoked with a clojure map. However, the tooling already exists and has its own argument parsing. I want to avoid having to adjust all existing docs and always mentioning two ways to invoke stuff.
For example the most common command you'll run currently is
npx shadow-cljs watch app
Or, translated to what I'd want for tools
clj -Tshadow-cljs watch app
Which I believe is invalid, since it expects key/value pairs after the watch
function. So it would need to be something like
clj -Tshadow-cljs watch :build :app
Currently this is all possible by conventional means of using clojure.main
clj -M:shadow-cljs watch app
But that requires creating an alias and manually specifying :main-opts
. It also cannot really take advantage of -Tinstall-latest
.
I can think of many ways of letting tools opt-out of this behavior. Either by directly specifying it in the :tools/usage
map of their deps.edn
. Or via CLJ metadata on the namespace or vars directly, since the tooling resolves those already.
(ns my.tool
{:tools/usage {:parse-args false}}
...)
;; and/or
(defn watch
{:tools/usage {:parse-args false}}
[& args] ;; just the usual strings array
...)
I feel this has been discussed before, but couldn't find it. Also, which library does the clojure.run.exec
helper belong to? I couldn't find it.