Skip to content

Commit

Permalink
Add an example of a negative flag (i.e. --no-verbose)
Browse files Browse the repository at this point in the history
Question from #280
  • Loading branch information
TeXitoi committed Nov 20, 2019
1 parent e84b1cb commit 222fc99
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/negative_flag.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
struct Opt {
#[structopt(long = "no-verbose", parse(from_flag = std::ops::Not::not))]
verbose: bool,
}

fn main() {
let cmd = Opt::from_args();
println!("{:#?}", cmd);
}

0 comments on commit 222fc99

Please sign in to comment.