tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
practicalli-john 2021-04-04T06:53:39.361300Z

I just use my shell history, I never have to type in a full command more than once. I have zsh (presto) with fish shell completion. A lot simpler than any other approach.

2021-04-04T16:41:59.363900Z

With the latest tools.deps, is it possible to use -M with --report stderr? I’m trying clojure -M:kaocha --report stderr, which used to work, and kaocha complains ‘Unknown option: “--report”’

alexmiller 2021-04-04T16:45:38.364300Z

That should work

alexmiller 2021-04-04T16:46:02.365Z

What’s the :kaocha alias?

alexmiller 2021-04-04T16:46:28.365600Z

I mean that’s an option to clojure.main, not kaocha

alexmiller 2021-04-04T16:46:59.366200Z

The error looks like it’s coming from kaocha, I think

2021-04-04T16:56:47.367400Z

The alias is

{:kaocha {:extra-deps
          {lambdaisland/kaocha {:mvn/version "1.0.641"}}
          :main-opts ["-m" "kaocha.runner"]}}

2021-04-04T16:57:06.367800Z

kaocha shouldn’t be seeing the --report iiuc

seancorfield 2021-04-04T17:13:47.368400Z

@hugod Everything after -m gets passed to that -main function.

seancorfield 2021-04-04T17:14:18.369100Z

If you want --report to work, you need to invoke clojure.main (and have it invoke the koacha.runner)

seancorfield 2021-04-04T17:14:47.369800Z

:main-opts ["--report" "stderr" "-m" "kaocha.runner"] — try that?

2021-04-04T17:16:09.370800Z

Um, that’s unfortunate. Also not what clj --help implies.

alexmiller 2021-04-04T17:19:14.371100Z

Which part?

2021-04-04T17:21:40.372300Z

It seems like you should be able to chose a report option when running a main with -M.

borkdude 2021-04-04T17:21:59.372700Z

I would expect: clj --report stderr -M:kaocha kaocha-args... here: everything after -M gets passed to clojure.main / the subtask, everything before gets parsed by the clojure CLI (but this is not according to the help)

borkdude 2021-04-04T17:28:17.374700Z

or is --report an option to clojure.main as well?

borkdude 2021-04-04T17:29:01.374900Z

oh I see, it is. yeah, I guess you can't really put stuff in between the main args in your deps.edn alias from the command line

alexmiller 2021-04-04T17:51:29.375800Z

You can also activate that property with a Java system prop, that might combine better here

alexmiller 2021-04-04T17:53:17.376500Z

-J-Dclojure.main.report=stderr

alexmiller 2021-04-04T17:53:32.376800Z

^ add to clj command line

alexmiller 2021-04-04T17:54:54.377500Z

clj -J-Dclojure.main.report=stderr -M:kaocha

2021-04-04T17:57:35.379600Z

ok, that looks like it works as a consistent way (over all possible invocation types) of specifying it. It would still be nice to be able to specify it somehow with --report though.

borkdude 2021-04-04T18:00:30.380200Z

as this is probably a user preference, maybe it could be a setting in $HOME/.clojure/deps.edn?

borkdude 2021-04-04T18:01:17.380700Z

or you could make an alias with jvm opts and combine it -M:report:kaocha ?

borkdude 2021-04-04T18:01:42.381100Z

not sure if jvm opts concatenate when you combine aliases, do they?

seancorfield 2021-04-04T18:24:44.381300Z

Yes, they do.

seancorfield 2021-04-04T18:24:58.381700Z

:main-opts do not, most everything else does.