tools-deps

mwolf 2024-06-07T17:58:35.429009Z

I want to add collections of common args to deps.edn to be specified for use with a tool, but clj complains that "Specified aliases are undeclared and are not being used: [...]". deps.edn:

:tools/usage {:ns-default example.cli}
:aliases     {:args/foo {:exec-args {:data-source-fn example-sources/foo, :data-source-args {:filename "foo-data"}}}
              :args/bar {:exec-args {:data-source-fn example-sources/bar, :data-source-args {:filename "bar-data"}}}}
after installing the tool, I assumed I could do either of the following:
$ clj -A:args/foo -Texample do-something
$ clj -A:args/bar -Texample do-something
... and example.cli/do-something would be called with a map containing the keys :data-source-fn and :data-source-args, but clj whines about :args/foo and :args/bar. the following, however, work (with appropriate quoting, I'm typing these from memory):
$ clj -Texample do-something :data-source-fn example-sources/foo :data-source-args {:filename "foo-data"}
$ clj -Texample do-something :data-source-fn example-sources/bar :data-source-args {:filename "bar-data"}
shouldn't the -A option cause the map from :exec-args to be merged? am I misunderstanding -A/`:exec-args`?

seancorfield 2024-06-07T18:01:11.988339Z

What does clj -version say?

seancorfield 2024-06-07T18:03:25.678839Z

sean@sean-win11-desk:~/clojure$ clj -A:a/b -T:c/d
{:a 1, :b 2}
sean@sean-win11-desk:~/clojure$ fgrep :exec deps.edn 
  :a/b {:exec-args {:a 1 :b 2}}
  :c/d {:exec-fn clojure.core/println}

Alex Miller (Clojure team) 2024-06-07T18:03:48.395549Z

I agree with your expectation that this should work, not sure if something misaligned or bug

Alex Miller (Clojure team) 2024-06-07T18:05:06.754359Z

can you clarify what this means "clj whines about :args/foo and :args/bar "?

seancorfield 2024-06-07T18:09:48.087639Z

@mbarillier said Specified aliases are undeclared and are not being used: [...]".

seancorfield 2024-06-07T18:12:34.462139Z

So running clojure -X:deps aliases would probably help diagnose here too...

mwolf 2024-06-07T18:23:40.094629Z

version is 1.11.3 "should work" is different than "it doesn't work that way" or that one specific bit is obviously wrong, I've got something borked. will fix, thx ...

seancorfield 2024-06-07T18:27:53.631279Z

If it says the aliases are not declared then maybe you're not running the clj command in the folder containing that deps.edn file?

seancorfield 2024-06-07T18:29:00.063349Z

(aliases are not transitive, BTW, so if they are in the tool's deps.edn file rather than yours, the CLI will not see them -- aliases come from just three places: the root, built into the CLI, the user, and the project)