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