Hi all,
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-matichttps://github.com/l3nz/cli-matic that basically requires a configuration struct and some functions to actually implement functionality, and takes care of the rest.
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.
The library still has a long way to go, but I think it’s useful enough to be used profitably by somebody else.
As per your code comments - I agree, and my feeling was “maybe one or two cases, I don’t leave dangling parentheses”. Boy I was wrong - and I did not notice (on my defense, I rely on Cursive to do the formatting, and I just did not notice)! Any suggestions on tools that may simpllify formatting / spot weirdnesses?
Hello,
Seems that you are having fun writing cli scripts.
I don’t want to underestimate your work, but have you considered using docopt? Docopt is an standard description for command line parsing that has implementations for many different languages,including Clojure. The cool part is that the help message is also the api description and the parser.
It’s a shame that it does not have a ClojureScript implementation
What do you mean ? If you input any command or subcommand wrong it will display the help, but I think it also displays sub-command only help if you input a sub-command wrong.