This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-16
Channels
- # announcements (11)
- # atom-editor (4)
- # babashka (26)
- # beginners (126)
- # calva (35)
- # chlorine-clover (14)
- # clj-kondo (50)
- # cljfx (1)
- # cljs-dev (1)
- # cljsrn (3)
- # clojure (31)
- # clojure-europe (144)
- # clojure-germany (2)
- # clojure-nl (3)
- # clojure-serbia (17)
- # clojure-spain (11)
- # clojure-uk (38)
- # clojurescript (87)
- # community-development (1)
- # conjure (1)
- # datalog (1)
- # datascript (160)
- # datomic (28)
- # duct (2)
- # emacs (4)
- # events (1)
- # figwheel-main (1)
- # fulcro (15)
- # graalvm (4)
- # honeysql (53)
- # jobs (2)
- # jobs-discuss (14)
- # juxt (6)
- # lsp (59)
- # malli (13)
- # music (1)
- # off-topic (8)
- # pathom (22)
- # portal (7)
- # re-frame (2)
- # reagent (3)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (1)
- # shadow-cljs (25)
- # sql (3)
- # tools-deps (38)
- # xtdb (17)
the funny thing is that this works in babashka. has anyone else encountered such an issue?
on the #clojure channel the answer was to rename my source file to .cljc
that works, but now i wonder if i should name my babashka scripts with the .bb
extension or not... 😕
Babashka is more accepting here. Just rename to .cljc works if you also want to run it with Clojure
^ https://twitter.com/huahaiy/status/1371689142585753604 That's really exciting since we can now have our datalog database from babashka scripts directly :)

Playing around with a task runner idea for babashka:
borkdude@MBP2019 /tmp/test $ cat bb.edn
{:tasks {:eval-plus {:babashka/args ["-e" "(+ 1 2 3)"]}
:tree {:babashka/args [:clojure "-Stree"]}
:count-files {:babashka/process ["bash" "-c" "ls | wc -l"] }}}
borkdude@MBP2019 /tmp/test $ bb :eval-plus
6
borkdude@MBP2019 /tmp/test $ bb :count-files
1
borkdude@MBP2019 /tmp/test $ bb :tree | head
org.clojure/clojure 1.10.1
. org.clojure/spec.alpha 0.2.176
. org.clojure/core.specs.alpha 0.2.44

Is it possible to use symbols instead of keywords as keys? eg:
$ cat bb.edn
{:tasks {eval-plus {:babashka/args ["-e" "(+ 1 2 3)"]}
tree {:babashka/args [:clojure "-Stree"]}
count-files {:babashka/process ["bash" "-c" "ls | wc -l"] }}}
$ bb eval-plus
It looks neater.That's an opinion, but we can consider. I was hoping to avoid clashes with existing filenames. Could you maybe post this feedback here? https://github.com/babashka/babashka/issues/756
> I was hoping to avoid clashes with existing filenames. Ah! I get it now. Makes sense.
So I implemented some kind of lein do
constructions for this task runner idea.
The issue there is: should we do the same as lein: use comma as delimiter between tasks? Some other character (which does not conflict with the shell, such as &&
?
$ bb :do '(prn :foo)' :do '(prn :bar)' :do :clojure
:foo
:bar
Clojure 1.10.2
user=> ^D
{:tasks {:eval-plus {:babashka/args [-e (+ 1 2 3)]}
:tree {:babashka/args [:clojure -Stree]}
:count-files {:babashka/process [bash -c "ls | wc -l"] }
:all {:babashka/args [:do :eval-plus
:do :tree
:do :count-files]}}}
$ bb :all
6
org.clojure/clojure 1.10.1
. org.clojure/spec.alpha 0.2.176
. org.clojure/core.specs.alpha 0.2.44
1
Maybe not the best and might conflict with CLI args called :do
, but suggestions welcome.
@borkdude It depends on the use case. But, in a common, when we put data into a string we ruin data. So, "should we do the same as lein: use comma as a delimiter between tasks?" I guess not. I propose to use some structured data in the command line too. Example is below (but may be I'm overengineering)
bb :do '[(prn :foo) (prn :bar) :clojure]' ;; or
bb '{:do [(prn :foo) (prn :bar) :clojure] :some-other-do-params :out-to-kafka}'
@mike1452 I want to allow people passing args as they normally do on the command line, only for multiple tasks at the same time (not as one quoted string).
I would consider :.
as the separator, but according the spec this isn't a valid keyword.
or maybe it should only be allowed in the bb.edn file, then it's easy:
[:do [:eval-plus] [:tree] [:count-files]]
but the idea of bb.edn file babashka/args
is that it acts as if you pass those from the command line...