mirror of
https://github.com/clap-rs/clap
synced 2024-12-12 22:02:35 +00:00
31b22d1a51
Someone should not reasonably expect a coun flag to go up to billions, millions, or even thousands. 255 should be sufficient for anyone, right? The original type was selected to be consistent with `ArgMatches::occurrences_of` but that is also used for tracking how many values appear which can be large with `xargs`. I'm still conflicted on what the "right type" is an wish we could support any numeric type. When I did a search on github though, every case was for debug/quiet flags and only supported 2-3 occurrences, making a `u8` overkill. This came out of a discussion on #3792
14 lines
266 B
Rust
14 lines
266 B
Rust
use clap::Parser;
|
|
|
|
#[derive(Parser)]
|
|
#[clap(author, version, about, long_about = None)]
|
|
struct Cli {
|
|
#[clap(short, long, action = clap::ArgAction::Count)]
|
|
verbose: u8,
|
|
}
|
|
|
|
fn main() {
|
|
let cli = Cli::parse();
|
|
|
|
println!("verbose: {:?}", cli.verbose);
|
|
}
|