Let's show what I mean with an example of a program argument:
-q, --quiet, --silent: Don't show output
I tried to do
#[derive(Parser)]
#[command(version = "0.1.0")]
struct Args {
// ...
#[arg(short, long = ["quiet", "silent"], default_value_t = false)]
quiet: bool,
}
but rust gives me an error because the long argument takes a string, not an array, but is there a workaround using clap to have multiple possible names for the same argument ?
I need to use the alias argument to arg for that (or visible_alias if I want it to display on the help message)
#[arg(short, long, visible_alias = "silent")]
quiet: bool,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With