Import structopt-0.3.14
Change-Id: I03e7eaf9f442092701ce3175cb78c8ea2237f616
diff --git a/examples/negative_flag.rs b/examples/negative_flag.rs
new file mode 100644
index 0000000..b178bf5
--- /dev/null
+++ b/examples/negative_flag.rs
@@ -0,0 +1,15 @@
+//! How to add `no-thing` flag which is `true` by default and
+//! `false` if passed.
+
+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);
+}