Fork me on GitHub
#tools-deps
<
2022-06-17
>
Alex Miller (Clojure team)00:06:38

yeah, I wasn't aware there were any so didn't occur to me

borkdude15:06:32

I'm trying to expose something as a clj tool, but I don't see why this is failing:

$ clojure -Ttools install io.github.borkdude/jet '{:git/sha "18bfbda4237f295877addafe87e5a5eb8e1b0698"}' :as jet
Execution error (NullPointerException) at clojure.tools.deps.alpha.util.dir/canonicalize (dir.clj:30).
null

Alex Miller (Clojure team)15:06:24

I got

% clojure -Ttools install io.github.borkdude/jet '{:git/sha "18bfbda4237f295877addafe87e5a5eb8e1b0698"}' :as jet
Cloning: 
Execution error (ExceptionInfo) at clojure.tools.deps.alpha.extensions.git/eval1445$fn (git.clj:113).
Commit not found for io.github.borkdude/jet in repo  at 18bfbda4237f295877addafe87e5a5eb8e1b0698

Alex Miller (Clojure team)15:06:02

not sure what version of clojure you're using, it has changed several times in this area lately

Alex Miller (Clojure team)15:06:31

but indeed, I don't see that as a valid commit sha

borkdude15:06:15

Forgot to push facepalm Now it works

Alex Miller (Clojure team)15:06:33

% clojure -Ttools install-latest :lib io.github.borkdude/jet :as jet
Checking out:  at 73e0be021a290a95bf1d671102be1b4b25c2b5a4
Installed tool jet as: io.github.borkdude/jet {:git/tag "v0.2.18", :git/sha "73e0be0"}

Alex Miller (Clojure team)15:06:39

using the new install-latest ...

borkdude15:06:24

Cool. But that one didn't have the exec function yet, just added it :) Is there also a way to invoke a tool with a default function, so you don't have to write:

clj -Tjet exec ...

practicalli-john17:06:03

This is why I use an alias rather than the tool name. With an alias you can specify the function to call

👍 1
Alex Miller (Clojure team)15:06:54

no, we're kind of on the fence about making that optional, so it's required right now

👍 1
borkdude15:06:55

Can you also install a mvn dep as a tool? I guess not right, since it won't have the :ns-default info available?

borkdude15:06:34

Anyway, #jet is now available for deps.edn too: https://github.com/borkdude/jet#depsedn I was able to support both -M and -X/-T style invocations with minimal boilerplate thanks to #babashka-cli :-D

Alex Miller (Clojure team)15:06:04

right, you can install, but you can't publish the usage stuff. I'm not sure yet what a good way to do that is, whether it should be something you added to pom or put it in a resource in the jar etc. just needs a bit more thought

👍 1
seancorfield16:06:18

Presumably, there's a potential parsing conflict if the exec function is omitted (made a default)? clojure -Tthing what are '{these args?}' vs clojure -Tthing func what '[are these args?]' since you can't really assume anything based on the number of arguments?