Struct structopt_flags::Verbose
source · pub struct Verbose { /* private fields */ }
Expand description
This struct provides the --verbose
cli option
By default, the log level is set to error. Multiple occurrences, will increase the verbosity level up to 4.
extern crate structopt_flags;
#[macro_use]
extern crate structopt;
use structopt::StructOpt;
use structopt_flags::LogLevel; // to access get_log_level
#[derive(Debug, StructOpt)]
#[structopt(name = "verbose", about = "An example using verbose flag")]
struct Opt {
#[structopt(flatten)]
verbose: structopt_flags::Verbose,
}
fn main() {
let opt = Opt::from_args();
let filter_level = opt.verbose.get_level_filter();
// set log level
}
Trait Implementations
sourceimpl LogLevel for Verbose
impl LogLevel for Verbose
sourcefn get_level_filter(&self) -> LevelFilter
fn get_level_filter(&self) -> LevelFilter
Return the level filter. Read more
sourcefn get_log_level(&self) -> Option<Level>
fn get_log_level(&self) -> Option<Level>
Return the log level. Read more
sourceimpl StructOpt for Verbose
impl StructOpt for Verbose
sourcefn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Creates the struct from
clap::ArgMatches
. It cannot fail
with a parameter generated by clap
by construction. Read moresourcefn from_args() -> Selfwhere
Self: Sized,
fn from_args() -> Selfwhere
Self: Sized,
Gets the struct from the command line arguments. Print the
error message and quit the program in case of failure. Read more
sourcefn from_iter<I>(iter: I) -> Selfwhere
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter<I>(iter: I) -> Selfwhere
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
Gets the struct from any iterator such as a
Vec
of your making.
Print the error message and quit the program in case of failure. Read moresourcefn from_iter_safe<I>(iter: I) -> Result<Self, Error>where
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error>where
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
Gets the struct from any iterator such as a
Vec
of your making. Read moreAuto Trait Implementations
impl RefUnwindSafe for Verbose
impl Send for Verbose
impl Sync for Verbose
impl Unpin for Verbose
impl UnwindSafe for Verbose
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more