Skip to main content

CliSubcommand

Trait CliSubcommand 

Source
pub trait CliSubcommand {
    // Required methods
    fn cli_command() -> Command;
    fn cli_dispatch(&self, matches: &ArgMatches) -> Result<(), Box<dyn Error>>;
}
Expand description

Trait for types that can be mounted as CLI subcommand groups.

Implemented automatically by #[cli] on an impl block. Allows nested composition: a parent CLI can mount a child’s commands as a subcommand group.

Required Methods§

Source

fn cli_command() -> Command

Build the clap Command tree for this type’s subcommands.

Source

fn cli_dispatch(&self, matches: &ArgMatches) -> Result<(), Box<dyn Error>>

Dispatch a matched subcommand to the appropriate method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§