Skip to main content

Subcommands

Derive Macro Subcommands 

Source
#[derive(Subcommands)]
{
    // Attributes available to this derive:
    #[usage]
    #[command]
    #[arg]
    #[value]
    #[group]
}
Expand description

Compile an enum into a set of subcommands.

Each variant may wrap a struct deriving Args or declare its fields inline. A field holding this enum is marked #[usage(subcommand)].

#[usage(run)], #[usage(run_with)], #[usage(run_async)] or #[usage(run_async_with)] on the enum also writes the match that hands the selected command to its implementation; see the crate docs.