Fork me on GitHub
#beginners
<
2023-05-10
>
rollergui20:05:06

Hey there, nice people 🙂 I'm looking for ways to practice clojure in a "real world" scenario, so I've decided to build a CLI tool... is there a recommended framework for such? I might as well not use anything, I was just wondering cause most of the tutorials I found are for web services

Bob B20:05:44

a few popular libraries for parsing CLI args include: • tools.cli (<https://github.com/clojure/tools.cli>) • cli-matic (<https://github.com/l3nz/cli-matic>) • babashka.cli (<https://github.com/babashka/cli>)

t-hanks 1
lread20:05:51

There's also https://github.com/nubank/docopt.clj. Fwiw, my favourite these days is babashka.cli.

t-hanks 1
☝️ 1
alpox22:05:11

Babashka also as runtime for the CLI

Ed22:05:45

One of my favourite tricks is if you write your code to accept symbols, you can make a quick and dirty command line parser like this:

(ns scratch)

(defn main [{:syms [--option]}]
  (prn --option))
and execute it like
$ clj -X scratch/main --option test
test