Skip to content

Arguments for a set of subcommands #5070

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

You must be logged in to vote

For the immediate question, the answer is "there isn't a built-in way".

This can be handled on the users end by

  • Putting the arguments into a help_heading that is named after the subcommand
    • Or providing a custom help / help template
  • Doing the validation on your side
    • This would require using Option for the arguments, rather than setting a default, since you don't have access to ArgMatches::value_source (#3846)

In terms of the features we support, we need to balance ease of use, build time, and binary size (which all encourage fewer features) with flexibility. We try to strike this balance by asking (1) what the CLI best practices are that we should be encouraging and (2) can excepti…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

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