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§
sourcefn commands() -> &'static [&'static CommandInfo]
fn commands() -> &'static [&'static CommandInfo]
Info about supported subcommands.
sourcefn try_redact_arg_values(
command_name: &[&str],
args: &[&str],
) -> Option<Result<Vec<String>, EarlyExit>>
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
.
sourcefn try_from_args(
command_name: &[&str],
args: &[&str],
) -> Option<Result<Self, EarlyExit>>
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
.