This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-24
Channels
- # adventofcode (2)
- # anglican (1)
- # announcements (4)
- # aws (2)
- # babashka (28)
- # beginners (18)
- # brompton (3)
- # calva (22)
- # clj-kondo (2)
- # cljdoc (29)
- # clojure (41)
- # clojure-europe (28)
- # clojure-gamedev (14)
- # clojure-nl (2)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (53)
- # css (3)
- # cursive (6)
- # duct (3)
- # emacs (5)
- # fulcro (29)
- # introduce-yourself (1)
- # liberator (5)
- # lsp (1)
- # malli (11)
- # meander (4)
- # nbb (11)
- # off-topic (17)
- # pathom (2)
- # polylith (8)
- # practicalli (1)
- # react (6)
- # reagent (11)
- # releases (2)
- # rewrite-clj (11)
- # shadow-cljs (59)
- # tools-deps (21)
- # vim (11)
anybody got recs for a jvm command line args library? I want to add some simple flags (like -h
and --version
) to my production uberjar, maybe some commands too
nvm, looks like https://github.com/clojure/tools.cli is the winner
it looks awesome! one question: just glancing at docs, I'm not sure how easy it'd be to have a subcommand, e.g. java -jar my.jar command subcommand --subcommand-arg
where --subcommand-arg
is only valid on the child command, and so on with command other-subcommand --other-subcommand-arg
it kind of seems like it might be possible to use subparsers to achieve this--have you run into this before?
@U49U72C4V That sounds familiar. Let me see if there was a ticket about that...
Does this help at all? https://github.com/clojure/tools.cli#in-order-processing-for-subcommands
I inherited cli so it has a long history before me but I gather POSIX arg parsing compliance was a core goal so...
that's very good, i'm sure the rest of the software world will catch up and be POSIX compliant soon
Given the push for exec fns and EDN key/value arguments in the Clojure world, I wouldn't be too sure about that π
Also checkout nubank docopt which supports subcommands. Itβs based on tools.cli, also works with babashka
see http://docopt.org/ basically - you write the usage - and docopt does the parsing and gives you a map with the results.