Search code examples
rustclap

Migrating clap-rs from 3-beta to 3-stable: `error: no method named `about` found for struct `Arg` in the current scope`


So I'm reading the docs and I can see the attribute still exists https://github.com/clap-rs/clap/blob/v3.1.6/examples/derive_ref/README.md#arg-attributes

I'm getting:

no method named `about` found for struct `Arg` in the current scope

Am I missing something?

#[derive(Parser)]
#[clap(about("Entry point"))]
struct ForecastingCli {
    #[clap(
        short('c'),
        long,
        global(true),
        value_name("FILE"),
        about = "config file"
    )]
    config: Option<PathBuf>,
}

Solution

  • It looks like in 3.*.beta help() was deprecated in favor of about(), because they were looked as redundant, and somewhat similar to App::about().

    But then they changed their minds and reverted that change before the 3.0 release, deleting instead about().

    So, just use Arg::help() instead.

    Same thing for long_help() and long_about().