This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-16
Channels
I just had a realization about how REPL-friendly babashka/cli
really is.
(cli/dispatch [{:cmds ["install"] :fn identity}]
["install" "myfile.clj"])
;; => {:cmds ("install" "myfile.clj"),
;; :args ("myfile.clj"),
;; :rest-cmds ("myfile.clj"),
;; :opts {},
;; :dispatch ["install"]}
Itβs just data! I donβt really have to start my CLI every time to debug, I might as well call a function with data from the REPL.
No questions, just note from a happy library consumer.reading this, my mind goes back to that mock clojure marketing video and the "it's just data!" with an explosion going off in the background (in a good way)
How can I capture output from a shell
task/call? Here is what I've tried:
{:tasks
{minor-version "0.6"
rev-count (shell "git rev-list HEAD --count")
patch-version {:depends [minor-version rev-count]
:task (format "%s.%" minor-version rev-count)}}}}
Which gives:
$ bb run --prn patch-version
1092
"0.6.babashka.process.Process@bf50da14"
I also tried:
{:tasks
{minor-version "0.6"
patch-version {:depends [minor-version rev-count]
:task (format "%s.%" minor-version (with-out-str (shell "git rev-list HEAD --count")}}}}
but that just output:
1092 # output of rev-count task
"0.6."
nice, ty!
btw all options for shell can be found in the docs of this library: https://github.com/babashka/process
Wow, these are both very cool projects. Being able to get mvn dependencies without java could open up many possibilities. For example, shadow-cljs might be able to use this
Yeah that's true
Afaik it uses clever optimizations like aot to speed up startup time
but you're right, that kind of defeats the purpose of removing the java requirement
yes, that catches folks by surprise β the fact that you have to install java when using bb with maven deps
not a big thing, but a quality of life improvement