tools-deps

seancorfield 2023-09-14T06:35:21.922989Z

Is there an easier way to do this?

clojure -A:deps -Sdeps '{:deps {my/lib {:local/root "."}}}' -X help/doc :ns next.jdbc.sql
(assuming I'm in the next.jdbc repo and want to display all the docs for the specific ns) The "problem" is that the :deps alias removes the project context: https://github.com/clojure/tools.deps/blob/master/src/main/resources/clojure/tools/deps/deps.edn#L9-L10 I'm not sure what the "best" solution would be here but perhaps a variant of the :deps alias that used :extra-deps (and no paths modifiers)?

seancorfield 2023-09-14T06:40:33.236979Z

With a user alias like:

:deps+ {:extra-deps {org.clojure/tools.deps.cli {:mvn/version "RELEASE"}}
        :ns-default clojure.tools.deps.cli.api
        :ns-aliases {help }}
  
it becomes much more manageable:
clojure -X:deps+ help/doc :ns next.jdbc.sql

Alex Miller (Clojure team) 2023-09-14T12:15:22.223429Z

What are you actually trying to do? View the docstrings of namespaces in your own project?

seancorfield 2023-09-14T16:19:23.853459Z

Yes, I saw some toot (on Mastodon) about the power of clj -X and I was going to respond with "did you know you can get the docs about a namespace / function from the command-line?" but then I tried it and found it was harder than I expected.

seancorfield 2023-09-14T16:21:37.634519Z

In my various projects's build.clj files, I have a note in the docstring that you can get help on the build tasks with clojure -A:deps -T:build help/doc and my various tools projects say how to get help on the tool, e.g., clojure -A:deps -Tnew help/doc so I was hoping there was an "equivalent" for a project...

seancorfield 2023-09-14T16:24:12.967859Z

(I "solved" this by adding :deps+ as shown above to my user deps.edn file but I think it would encourage folks to start using help/doc more if it was built-in, to make it "easier" -- right now, a lot of folks using the CLI don't even know about help/doc, it seems, and have the complaint that discoverability of tasks to run is "hard")