pub struct Output {
pub colors: bool,
pub symbols: SymbolMode,
pub verbosity: Verbosity,
pub json: bool,
}Expand description
Output handler with styled terminal output.
Respects configuration for colors, symbols, and verbosity levels. Supports JSON output mode for scripting and machine consumption.
Fields§
§colors: boolWhether to use ANSI colors
symbols: SymbolModeSymbol mode (unicode or ascii)
verbosity: VerbosityVerbosity level
json: boolWhether to output JSON instead of human-readable text
Implementations§
Source§impl Output
impl Output
Sourcepub fn new(verbose: bool, quiet: bool, json: bool) -> Self
pub fn new(verbose: bool, quiet: bool, json: bool) -> Self
Create output handler from CLI flags.
Loads config to get style settings, then applies CLI flag overrides.
NO_COLOR environment variable takes precedence over config.
Sourcepub fn use_color(&self) -> bool
pub fn use_color(&self) -> bool
Whether ANSI color codes are enabled.
Used by modules like doctor::format_report() to decide whether
to include color escapes in their output.
Sourcepub fn success_symbol(&self) -> &'static str
pub fn success_symbol(&self) -> &'static str
Get success symbol based on symbol mode.
Sourcepub fn error_symbol(&self) -> &'static str
pub fn error_symbol(&self) -> &'static str
Get error symbol based on symbol mode.
Sourcepub fn info_symbol(&self) -> &'static str
pub fn info_symbol(&self) -> &'static str
Get info symbol based on symbol mode.
Sourcepub fn warning_symbol(&self) -> &'static str
pub fn warning_symbol(&self) -> &'static str
Get warning symbol based on symbol mode.
Sourcepub fn success(&self, message: &str)
pub fn success(&self, message: &str)
Print a success message.
Suppressed in quiet mode. Uses green color when colors are enabled. Writes to stderr to avoid corrupting stdout data output.
Sourcepub fn error(
&self,
error_type: &str,
message: &str,
cause: Option<&str>,
help: Option<&str>,
)
pub fn error( &self, error_type: &str, message: &str, cause: Option<&str>, help: Option<&str>, )
Print an error message with optional cause and help text.
Always printed (even in quiet mode). Uses red color when colors are enabled.
Sourcepub fn warning(&self, message: &str)
pub fn warning(&self, message: &str)
Print a warning message.
Suppressed in quiet mode. Uses yellow color when colors are enabled. Writes to stderr to avoid corrupting stdout data output.
Sourcepub fn debug(&self, message: &str)
pub fn debug(&self, message: &str)
Print a debug message.
Only printed in verbose mode. Uses gray color when colors are enabled. Writes to stderr to avoid corrupting stdout data output.
Sourcepub fn info(&self, message: &str)
pub fn info(&self, message: &str)
Print an info message.
Suppressed in quiet mode. Writes to stderr to avoid corrupting stdout data output.
Sourcepub fn style_command(&self, text: &str) -> String
pub fn style_command(&self, text: &str) -> String
Style text as an inline command (cyan with color, backtick-wrapped without).
Used for displaying command suggestions like rec start or rec stop.
Sourcepub fn style_success(&self, text: &str) -> String
pub fn style_success(&self, text: &str) -> String
Style text as success (green with color, plain without).
Sourcepub fn style_error(&self, text: &str) -> String
pub fn style_error(&self, text: &str) -> String
Style text as error (red with color, plain without).
Sourcepub fn is_verbose(&self) -> bool
pub fn is_verbose(&self) -> bool
Check if verbose mode is enabled.