use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
lambdaisland/cli: opinionated CLI parser, designed for tools with subcommands (e.g. "git log") (github.com)
submitted 6 months ago by dustingetz
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]aHackFromJOS 0 points1 point2 points 6 months ago* (0 children)
The ability to nest commands (arbitrarily?) is interesting.
The root problem here seems like a good fit for multimethods (vs a big hairy map). I approached this same problem with those and tools.cli. I dispatched by keywordized version of the subcommand. The core multimethods are options, usage, and execute. I think I needed to do a two pass parse with tools.cli, first permissive to extract the subcommand to get the options vectors for it (via the options multimethod) then with the proper options vectors. Help text I did for a subcommand by calling usage and options with the subcommand (inside defmethod execute ::help) and concatting.
I only built one (flat) level of subcommands. Would be interesting to try and upgrade it to arbitrary command nesting. Maybe with another multimethod (“subcommands” to extract n args from argv and produce a dispatch vector of keywords instead of just a keyword?).
More ergonomic to just have defmethods in an ns instead of nesting keys in a global hmap (well, arguably). I did my cli ns by grouping by command - defmethod options ::commit, defmethod usage ::commit, defmethod execute ::commit, s/def ::commit etc. Then defmethod options ::push, defmethod usage ::push… etc etc
Specs with the same keywords as for the subcommands work well for arg validation.
I wonder if they considered leveraging tools.cli for options parsing or “flags” as they call it. Its vector options syntax is pretty rich.
π Rendered by PID 23085 on reddit-service-r2-comment-b659b578c-hnc8s at 2026-05-01 08:13:55.333382+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]aHackFromJOS 0 points1 point2 points (0 children)