Skip to content

How to alias subcommand and option? #837

Answered by phlptp
foonathan asked this question in Q&A
Discussion options

You must be logged in to vote

Usually what has been done in the past in cases where this is required is to add an option or flag with -v and --version and then a separate subcommand that has a callback that does the same thing as the option. If it is complicated then the callback versions of the option/flag can be used and the same callback used in the subcommand callback. This is a little "cleaner" than making a subcommand alias of "--version"

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@foonathan
Comment options

Answer selected by foonathan
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