Clap Short arguments
-
short
-
We can allow to use
-xshort names (defaults to the first letter of the attribute) -
We can set the letter ourselves.
use clap::Parser;
#[derive(Parser)]
struct Cli {
#[arg(short)]
debug: bool,
#[arg(short = 'H')]
host: String,
}
fn main() {
let args = Cli::parse();
println!("debug: {}", args.debug);
println!("host: {}", args.host);
}