kometen
kometen

Reputation: 7832

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();

Upvotes: 4

Views: 1424

Answers (1)

user4815162342
user4815162342

Reputation: 155246

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.

Upvotes: 2

Related Questions