]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | //! How to add `no-thing` flag which is `true` by default and |
2 | //! `false` if passed. | |
3 | ||
4 | use structopt::StructOpt; | |
5 | ||
6 | #[derive(Debug, StructOpt)] | |
7 | struct Opt { | |
8 | #[structopt(long = "no-verbose", parse(from_flag = std::ops::Not::not))] | |
9 | verbose: bool, | |
10 | } | |
11 | ||
12 | fn main() { | |
13 | let cmd = Opt::from_args(); | |
14 | println!("{:#?}", cmd); | |
15 | } |