logo

Trait clap::Args

source · []
pub trait Args: FromArgMatches + Sized {
    fn augment_args(app: App<'_>) -> App<'_>;
fn augment_args_for_update(app: App<'_>) -> App<'_>; }
Expand description

Parse 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 impl Args.
  • Variant(ChildArgs): No attribute is used with enum variants that impl Args.

Example

#[derive(clap::Clap)]
struct Args {
    #[clap(flatten)]
    logging: LogArgs,
}

#[derive(clap::Args)]
struct LogArgs {
    #[clap(long, short = 'v', parse(from_occurrences))]
    verbose: i8,
}

Required methods

Append to App so it can instantiate Self.

See also IntoApp.

Append to App so it can update self.

This is used to implement #[clap(flatten)]

See also IntoApp.

Implementations on Foreign Types

Implementors