l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
363 stars 29 forks source link

[Ftr] Support repetition for flags ? e.g. ansible style verbose: -v / -vv / -vvv #154

Open ieugen opened 2 years ago

ieugen commented 2 years ago

Is your feature request related to a problem? Please describe.

I would like to implement verbose levels with repetition of the same flag. Something like it's done in ansible: ANSIBLE_DEBUG=true -vvvv ansible-playbook playbook.yml

Describe the solution you'd like

I would like to build a cli app to have an option for verbose level - with the ability to supply it multiple times:

{:as "Verbose level - multiple versions"
                   :short "v"
                   :option "verbose"
                   :multiple true
                   :type :with-flag}

Describe alternatives you've considered This is available in tools-cli

["-v" nil "Verbosity level"
    :id :verbosity
    :default 0
    :update-fn inc]

If this is available in the library, I could not find it in the README .

ieugen commented 2 years ago

Related to this case, I think it would be nice to support the :update-fn feature. I would like to have a way to process (merge) the values of :ednfile for example. This will get me a single value instead of an array.