mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
15 lines
303 B
Rust
15 lines
303 B
Rust
//! How to add `no-thing` flag which is `true` by default and
|
|
//! `false` if passed.
|
|
|
|
use clap::Clap;
|
|
|
|
#[derive(Debug, Clap)]
|
|
struct Opt {
|
|
#[clap(long = "no-verbose", parse(from_flag = std::ops::Not::not))]
|
|
verbose: bool,
|
|
}
|
|
|
|
fn main() {
|
|
let cmd = Opt::parse();
|
|
println!("{:#?}", cmd);
|
|
}
|