Search code examples
rustcommand-line-argumentsclap

Use more than one letter in short-value


I'm using clap to parse arguments. I want to use the single dash (-) and more than one character in the argument, like -Fmin 1. Adding long("Fmin") gives me that but with two dashes (--).

I'm aware that using a single dash and single character together is the norm. But is it possible to have clap use more than a single character when using the short() form? Or override the long-form so it defaults to a single dash?

let matches = App::new("clap")
    .arg(Arg::with_name("Fmin")
        .required(false)
        .takes_value(true)
        .short("Fmin")
        .multiple(false)
        .possible_values(&["min"])
    )
    .get_matches();

Solution

  • is it possible to have clap use more than a single character when using the short() form? Or override the long-form so it defaults to a single dash?

    Judging by this issue, single-hyphen long options are not yet supported by clap.