Fork me on GitHub
#babashka
<
2021-07-17
>
borkdude09:07:29

Fun way to get arg parsing without much boilerplate:

#!/usr/bin/env bb

(require '[selmer.parser :refer [<<]])
(let [[& {:strs [-a -b --long-opt]}] *command-line-args*]
  (<< "Command line opts: a: {{-a}}, b: {{-b}}, long-opt: {{--long-opt}}"))
$ ./cli.clj -a 1 -b 2 --long-opt 3
"Command line opts: a: 1, b: 2, long-opt: 3"

😃 26
nice 2
Cora (she/her)17:07:43

using babashka to execute babashka tests for blog posts https://github.com/corasaurus-hex/dev-to

🎯 12
❤️ 4
Cora (she/her)17:07:15

just the one post so far, but when I get to things like creating projects and code that has explicit version dependencies this'll get a lot more interesting