Skip to content

Implementing application-level aliases (like Git's aliases) #3672

Answered by epage
martinvonz asked this question in Q&A
Discussion options

You must be logged in to vote

If its of interest, this is how cargo implements aliases. They basically just treat it as an external subcommand (which is supported via the #[clap(external_subcommand)] alias rather than setting it on the Command) and do a parse with no_binary_name set. This won't provide the absolute best errors but its ok. They manually track global arguments rather than having clap do it so they can use them across the different parse invocations.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@martinvonz
Comment options

@martinvonz
Comment options

@epage
Comment options

Answer selected by martinvonz
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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