Trait Subcommand
trait Subcommand: FromArgMatches + Sized
Parse a sub-command into a user-defined enum.
Implementing this trait lets a parent container delegate subcommand behavior to Self.
with:
#[command(subcommand)] field: SubCmd: Attribute can be used with either struct fields or enum variants that implSubcommand.#[command(flatten)] Variant(SubCmd): Attribute can only be used with enum variants that implSubcommand.
NOTE: Deriving requires the derive feature flag
Required Methods
fn augment_subcommands(cmd: Command) -> CommandAppend to
Commandso it can instantiateSelfviaFromArgMatches::from_arg_matches_mutThis is used to implement
#[command(flatten)]See also
CommandFactory::command.fn augment_subcommands_for_update(cmd: Command) -> CommandAppend to
Commandso it can instantiateselfviaFromArgMatches::update_from_arg_matches_mutThis is used to implement
#[command(flatten)]See also
CommandFactory::command_for_update.fn has_subcommand(name: &str) -> boolTest whether
Selfcan parse a specific subcommand
Implementors
impl<T: Subcommand> Subcommand for Box<T>