Trait argh::DynamicSubCommand

source ·
pub trait DynamicSubCommand: Sized {
    // Required methods
    fn commands() -> &'static [&'static CommandInfo];
    fn try_redact_arg_values(
        command_name: &[&str],
        args: &[&str],
    ) -> Option<Result<Vec<String>, EarlyExit>>;
    fn try_from_args(
        command_name: &[&str],
        args: &[&str],
    ) -> Option<Result<Self, EarlyExit>>;
}
Expand description

Trait implemented by values returned from a dynamic subcommand handler.

Required Methods§

source

fn commands() -> &'static [&'static CommandInfo]

Info about supported subcommands.

source

fn try_redact_arg_values( command_name: &[&str], args: &[&str], ) -> Option<Result<Vec<String>, EarlyExit>>

Perform the function of FromArgs::redact_arg_values for this dynamic command.

The full list of subcommands, ending with the subcommand that should be dynamically recognized, is passed in command_name. If the command passed is not recognized, this function should return None. Otherwise it should return Some, and the value within the Some has the same semantics as the return of FromArgs::redact_arg_values.

source

fn try_from_args( command_name: &[&str], args: &[&str], ) -> Option<Result<Self, EarlyExit>>

Perform the function of FromArgs::from_args for this dynamic command.

The full list of subcommands, ending with the subcommand that should be dynamically recognized, is passed in command_name. If the command passed is not recognized, this function should return None. Otherwise it should return Some, and the value within the Some has the same semantics as the return of FromArgs::from_args.

Object Safety§

This trait is not object safe.

Implementors§