Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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();
like image 428
kometen Avatar asked Oct 27 '25 09:10

kometen


1 Answers

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.

like image 168
user4815162342 Avatar answered Oct 30 '25 08:10

user4815162342



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!