blob: b178bf5ae5a94a0ee3d66af2455c517bef250436 [file] [log] [blame]
Matthew Maurer32e76692020-06-02 11:15:15 -07001//! How to add `no-thing` flag which is `true` by default and
2//! `false` if passed.
3
4use structopt::StructOpt;
5
6#[derive(Debug, StructOpt)]
7struct Opt {
8 #[structopt(long = "no-verbose", parse(from_flag = std::ops::Not::not))]
9 verbose: bool,
10}
11
12fn main() {
13 let cmd = Opt::from_args();
14 println!("{:#?}", cmd);
15}