Skip to main content

Subcommand

Derive Macro Subcommand 

Source
#[derive(Subcommand)]
{
    // Attributes available to this derive:
    #[arg]
    #[command]
}
Expand description

Derive macro for an enum of subcommands, used by a #[command(subcommand)] field of a struct deriving GetArgs.

Each variant is a subcommand named after the kebab-cased variant name, which #[command(name = "...")] overrides. Variants can be unit variants, variants with named fields (declared with #[arg(...)] as in a GetArgs struct) or newtype variants wrapping a struct deriving GetArgs.

See the subcommands guide for details.