#[allow(unused_imports)] #[macro_use] extern crate structopt; extern crate failure; extern crate structopt_flags; #[macro_use] extern crate log; use failure::Error; use structopt::StructOpt; #[cfg(feature = "simplelog")] use structopt_flags::LogLevel; #[derive(Debug, StructOpt)] #[structopt(name = "verbose", about = "An example using verbose flag")] struct Opt { #[structopt(flatten)] verbose: structopt_flags::Verbose, } fn main() -> Result<(), Error> { let opt = Opt::from_args(); #[cfg(feature = "simplelog")] opt.verbose.set_log_level(); trace!("{}", opt.verbose); Ok(()) }