Struct structopt_flags::SimpleVerbose
source · pub struct SimpleVerbose {
pub verbose: bool,
}Expand description
This struct implements the --verbose cli option as a boolean flag
By default, the log level is set to warning.
Multiple occurrences of -v are not supported
extern crate structopt_flags;
#[macro_use]
extern crate structopt;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "verbose", about = "An example using verbose flag")]
struct Opt {
#[structopt(flatten)]
verbose: structopt_flags::SimpleVerbose,
}
fn main() {
let opt = Opt::from_args();
if opt.verbose.verbose {
println!("Verbose output enabled");
} else {
println!("No verbose output");
}
}Fields
verbose: boolEnable the verbose output No multiple occurrences are supported
Trait Implementations
sourceimpl Clone for SimpleVerbose
impl Clone for SimpleVerbose
sourcefn clone(&self) -> SimpleVerbose
fn clone(&self) -> SimpleVerbose
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for SimpleVerbose
impl Debug for SimpleVerbose
sourceimpl Display for SimpleVerbose
impl Display for SimpleVerbose
sourceimpl StructOpt for SimpleVerbose
impl StructOpt for SimpleVerbose
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 SimpleVerbose
impl Send for SimpleVerbose
impl Sync for SimpleVerbose
impl Unpin for SimpleVerbose
impl UnwindSafe for SimpleVerbose
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