working to give an error message to verify that the tools deps version is too old to support -M -m
. Does anyone know offhand if a version supported -X
but not -M -m
? Hoping can check something real quick with -X
and that means it necessarily supports -M
as it stands, added a simple (ns check) (defn -main [& _] (System/exit 0))
but would prefer to not need a new main and new ns if X
and M
go hand in hand
ie, could just do clojure -X clojure.core/identity :a :a
and if that returns 0 then good to go for -M -m our.stuff
@dpsutton I expect this is not what you are looking for, but I write my scripts in Babashka where I find a Clojure version check to be explicit and straightforward: https://github.com/lread/rewrite-cljc-playground/blob/60ad8c118a86221e35692f2ce10281e7cef0f8a4/script/helper/env.clj#L39
@dpsutton https://clojure.org/releases/tools might have the info about -X but not -M -m support... although I believe -X support wasnt added until https://clojure.org/releases/tools#v1.10.1.697 and -M -m was in by then. I use https://clojure.org/releases/tools#v1.10.1.697 as the minimum requirement for Clojure CLI tools with my aliases and content from Practicalli
-M
has been in the CLI for a long time but it's meaning changed around 1.10.1.697
The difference between 1.10.1.561 (stable) and the later version is just that -M
now respects resolve-args and classpath-args in aliases as well as main-opts. Previously, it ignored resolve-args and classpath-args. Does that help @dpsutton?
Yeah that does. I think that means we should use the check for X support to make sure we have a recent enough version
Although I think our use case is simple enough that as long as M support is there it’s fine
@dpsutton I just ran some tests on a bunch of prerelease versions between the last two stable releases, and there are several where that command returns a zero status but doesn't actually work.
(but I believe they would support -M
with aliases by that point... I just haven't tested that 🙂 )
In what way do they not work?
And thanks so much!
(! 1626)-> /usr/local/Cellar/clojure\@1.10.1.636/1.10.1.636/bin/clojure -X clojure.core/identity :a :a
No alias specified with -X
Thu Oct 29 09:58:15
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 1627)-> echo $?
0
The ability to pass the fn to execute on the command-line came fairly late in that set of prerelease builds.
1.10.1.672 seems to be the first prerelease build that allowed it.
Oh ok. It’s only prereleases? If so they can diagnose it on their own :)
Bleeding edge is sometimes bleeding
Yeah, 1.10.1.561 (previous stable) throws an exception and gives a non-zero exit status.
(so does 1.10.1.590 which was the first of the prerelease builds)
Beautiful. How do you change versions so quickly? Would have done that if I knew a good way to swap them around easily
I installed them by version with brew and then I can use the full path (as shown above) to run any version I want 🙂
clojure@1.10.1.561/ clojure@1.10.1.641/ clojure@1.10.1.697/
clojure@1.10.1.590/ clojure@1.10.1.645/ clojure@1.10.1.708/
clojure@1.10.1.596/ clojure@1.10.1.672/ clojure@1.10.1.716/
clojure@1.10.1.619/ clojure@1.10.1.681/ clojure@1.10.1.723/
clojure@1.10.1.636/ clojure@1.10.1.693/ clojure@1.10.1.727/
how are you doing this?
I didn't have 561 until just now, but installed it by version to test.
just brew install @version ?
brew install clojure/tools/clojure@1.10.1.561
per the CLI install docs
clear, thanks a lot!
See https://github.com/clojure/homebrew-tools (which is linked from the CLI install docs on the CLI guides page)
Oh I didn’t know it left older versions laying around