pub trait Args: FromArgMatches {
fn augment_args(cmd: App<'_>) -> App<'_>;
fn augment_args_for_update(cmd: App<'_>) -> App<'_>;
}
Expand description
Parse a set of arguments into a user-defined container.
Implementing this trait lets a parent container delegate argument parsing behavior to Self
.
with:
#[clap(flatten)] args: ChildArgs
: Attribute can only be used with struct fields that implArgs
.Variant(ChildArgs)
: No attribute is used with enum variants that implArgs
.
See the derive reference for attributes and best practices.
NOTE: Deriving requires the [derive
feature flag][crate::_features]
Example
#[derive(clap::Parser)]
struct Args {
#[clap(flatten)]
logging: LogArgs,
}
#[derive(clap::Args)]
struct LogArgs {
#[clap(long, short = 'v', parse(from_occurrences))]
verbose: i8,
}
Required Methods
sourcefn augment_args(cmd: App<'_>) -> App<'_>
fn augment_args(cmd: App<'_>) -> App<'_>
Append to Command
so it can instantiate Self
.
See also CommandFactory
.
sourcefn augment_args_for_update(cmd: App<'_>) -> App<'_>
fn augment_args_for_update(cmd: App<'_>) -> App<'_>
Append to Command
so it can update self
.
This is used to implement #[clap(flatten)]
See also CommandFactory
.
Implementations on Foreign Types
sourceimpl<T> Args for Box<T, Global>where
T: Args,
impl<T> Args for Box<T, Global>where
T: Args,
fn augment_args(cmd: App<'_>) -> App<'_>
fn augment_args_for_update(cmd: App<'_>) -> App<'_>
Implementors
impl Args for cucumber::parser::basic::Cli
impl Args for cucumber::runner::basic::Cli
impl Args for cucumber::writer::basic::Cli
impl Args for cucumber::writer::junit::Cli
Available on crate feature
output-junit
only.impl Args for cucumber::writer::libtest::Cli
Available on crate feature
libtest
only.