Struct rood::cli::output::OutputManager [−][src]
pub struct OutputManager { pub verbose: bool, // some fields omitted }
Expand description
The OutputManager is a nice wrapper over shell i/o functions.
It provides output nesting, various log levels and verbosity levels, as well as stack-like features for controlling more easily the indentation level of the output
Examples
Simple usage and stacked usage.
use rood::cli::OutputManager; let verbose_mode = false; let output = OutputManager::new(verbose_mode); output.step("[Step 1]"); output.push().debug("Some indented verbose-only message"); output.success("[Step 1] - OK")
Using a Yes/No prompt and handling errors.
use rood::cli::OutputManager; let output = OutputManager::new(false); match output.prompt_yn("Really to quit?", false) { Ok(val) => output.success(&format!("User picked: {}", val)), Err(e) => output.error(&format!("Error: {}", e)) }
Fields
verbose: bool
Implementations
Returns an OutputManager
of the specified verbosity.
Returns a new OutputManager
with the same verbosity level, but with an indentation
level incremented by one.
Returns a new OutputManager
with the same verbosity level, but with an indentation
level set to the level specified.
Displays a step. msg
will be printed in yellow, prefixed by a +
.
Displays a progress message. ̀msg` will be printed in white without a prefix.
Displays a success message. msg
will be printed in green, prefixed by a ‘+’.
Displays a debug message. msg
will be printed in blue, prefixed by a ‘-’.
Note: Debug messages are only printed when the verbose flag is set.
Displays an error message. msg
will be printed in red, prefixed by a ‘!’.
Displays a prompt. msg
will be printed in blue, prefixed by a ‘?’.
Will wait for user input before returning what the user typed.
Displays a yes/no prompt. msg
will be printed in blue, prefixed by a ‘?’.
Will wait for user input before returning what the user selected.
Displays a prompt for a password or any sensitive information. msg
will be printed in blue, prefixed by a ‘?’.
Will wait for user input before returning what the user typed.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for OutputManager
impl Send for OutputManager
impl Sync for OutputManager
impl Unpin for OutputManager
impl UnwindSafe for OutputManager
Blanket Implementations
Mutably borrows from an owned value. Read more