l3nz / cli-matic

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

Adding `app --version` #72

Open l3nz opened 5 years ago

l3nz commented 5 years ago

It's common for terminal apps to be called like app --version to print the version. Is this possible?

Originally posted by @thiru in https://github.com/l3nz/cli-matic/issues/35#issuecomment-480977084

l3nz commented 5 years ago

@thiru Added as separate bug.

l3nz commented 5 years ago

This should only be added as "--version" (with no shortcut) to global options.

So app --version will work and print :app :version, while app cmd --version has no meaning.

thiru commented 5 years ago

Yes that would be perfect, thank you!

l3nz commented 4 years ago

BTW, as per #69 , we could have recursive :version keys, so a subcomand could have different (sub) version.

thiru commented 4 years ago

Sweet thanks!

Versions on sub-commands seem niche. I personally haven't found a need for them but still nice to have the option.

abhi18av commented 2 years ago

Hello @l3nz ,

Could you please share a working example on how exactly, this could be achieved with cli-matic "0.4.3"] ?

I have been trying to get the same use case working app --version without success 😞 .