I find writing more and more scripts since I started using
clj, but one thing that I really did not like was all the boilerplate required for command-line parsing. The library
tools.cli is very powerful, but it requires writing way too much for my average script.
Plus, I generally use the subcommands in scripts, like e.g.
git log, and wanted a way to automate help and description.
So I wrote this little library
cli-matic https://github.com/l3nz/cli-matic that basically requires a configuration struct and some functions to actually implement functionality, and takes care of the rest.
You can see it in action in this very little toy calculator https://github.com/l3nz/cli-matic/blob/master/src/cli_matic/toycalc.clj - as you can see, there is basically nothing but the functions that do the computing plus a declarative configuration structure.
I am sharing it as I’m finding it useful - comments and hints are very welcome. Would love to make it work with both clj/cljs, if anyone is interested.