1 unstable release
0.1.0 | Oct 26, 2021 |
---|
#10 in #quite
Used in cli-toolbox
11KB
98 lines
Verbosity
Intended for use with cli
commands this library lets you set a singleton Verbosity
option to indicate different levels of reporting, i.e. Quite
| Terse
| Verbose
Example
let level = Verbosity::from_str(
&std::env::args().last().unwrap_or(String::new())
).unwrap_or(Verbosity::Quite);
level.set_as_global();
match Verbosity::level() {
Quite => {}
Terse =>
println!("terse message"),
Verbose =>
println!("overly verbose message for some command")
}
Related Crate
The cli-toolbox
crate uses this library to provide a more ergonomic way of
controlling reporting output
i.e.
let level = Verbosity::from_str(
&std::env::args().last().unwrap_or(String::new())
).unwrap_or(Verbosity::Quite);
level.set_as_global();
report! {
@terse "terse message"
@verbose "overly verbose message for some command"
}
Resources
- Docs for more detailed information
Usage
[dependencies]
verbosity = "0.1"
Dependencies
~475–790KB
~13K SLoC