This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-31
Channels
- # aleph (37)
- # babashka (23)
- # beginners (46)
- # calva (1)
- # catalyst (12)
- # cider (3)
- # circleci (5)
- # clj-kondo (8)
- # clojure (188)
- # clojure-europe (28)
- # clojure-nl (1)
- # clojure-norway (84)
- # clojure-sweden (2)
- # clojure-uk (1)
- # clojurescript (6)
- # clr (1)
- # cursive (4)
- # datahike (4)
- # datascript (7)
- # datomic (31)
- # deps-new (16)
- # emacs (4)
- # fulcro (4)
- # gratitude (17)
- # hyperfiddle (24)
- # introduce-yourself (4)
- # jobs (5)
- # off-topic (84)
- # pathom (10)
- # polylith (21)
- # portal (6)
- # re-frame (6)
- # reitit (4)
- # releases (1)
- # sci (74)
- # specter (3)
- # tools-build (3)
- # tools-deps (5)
Anyone going to JavaZone in Norway? @rahul080327 and @anupriyajo are giving a babashka workshop there! https://2023.javazone.no/program/19a5cab3-7afd-4dc1-b60a-bea8562d3186

Is there a way to have bb
report (at least something close to) the equivalent shell commands it performs for a task?
you can do something like this:
(alter-var-root #'babashka.process/*defaults* assoc :pre-start-fn println)
This is probably even better:
(alter-var-root #'babashka.process/*defaults* assoc :pre-start-fn #(apply println ">" (:cmd %)))
hmmm,
where do I put that if I'm running the task via bb run some:task
?
in bb.edn
right?
Yeah, but in this case, you can't use #'
and #(..)
so you have to write:
(alter-var-root (var babashka.process/*defaults*) assoc :pre-start-fn (fn [m] (apply println ">" (:cmd m))))
found some docs for :init
https://book.babashka.org/#_hooks
finally got it to work. my first time inside a bb.edn file
anyway, seems to work well. should save quite a bit of time
maybe a good idea for a future bb
option?
yeah perhaps. one of the issues that it's currently a bit verbose is that not everyone wants to have this logging in the same way as others
Looks like :init
isn't run if I use
bb -m my.entrypoint
Any way to run something in that case?I was thinking of chaining main calls, like so:
bb -m my.enable-debug -m my.entrypoint
but couldn't see how to make that work given that babshka.main doesn't seem to be available to require
I guess what I'm thinking is that it would be cool to have a way to specify a preload code to run ad-hoc on the cli for debugging or other tooling purposes
There is an env var for this BABASHKA_PRELOADS, see docs. There’s also the —init option
Ah, i'll check that out
This works like a charm and adds a touch of color
BABASHKA_PRELOADS='(alter-var-root (var babashka.process/*defaults*) assoc :pre-start-fn (fn [m] (println (str "\u001B[37m\u001B[45m" (pr-str (:cmd m)) "\u001B[0m"))))'