Skip to content

subcommands and --version command #189

Answered by DanCardin
Tobi-De asked this question in Q&A
Discussion options

You must be logged in to vote

you can do cappa.parse/invoke(Falco, version='1.2.3') (or version=cappa.Arg('1.2.3', short="-v", long="--version", help="print cli version") if the default arg definition isn't what you want).

I believe you should also be able to define it on the class itself if you prefer, by setting action=ArgAction.version. Although i personally wouldn't, because it doesn't really make sense as a normal class field, given that it will always just be the default value if not used.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tobi-De
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants