Skip to main content

Output

Struct Output 

Source
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: bool

Whether to use ANSI colors

§symbols: SymbolMode

Symbol mode (unicode or ascii)

§verbosity: Verbosity

Verbosity level

§json: bool

Whether to output JSON instead of human-readable text

Implementations§

Source§

impl Output

Source

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.

Source

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.

Source

pub fn success_symbol(&self) -> &'static str

Get success symbol based on symbol mode.

Source

pub fn error_symbol(&self) -> &'static str

Get error symbol based on symbol mode.

Source

pub fn info_symbol(&self) -> &'static str

Get info symbol based on symbol mode.

Source

pub fn warning_symbol(&self) -> &'static str

Get warning symbol based on symbol mode.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn info(&self, message: &str)

Print an info message.

Suppressed in quiet mode. Writes to stderr to avoid corrupting stdout data output.

Source

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.

Source

pub fn style_success(&self, text: &str) -> String

Style text as success (green with color, plain without).

Source

pub fn style_error(&self, text: &str) -> String

Style text as error (red with color, plain without).

Source

pub fn is_verbose(&self) -> bool

Check if verbose mode is enabled.

Source

pub fn is_quiet(&self) -> bool

Check if quiet mode is enabled.

Trait Implementations§

Source§

impl Clone for Output

Source§

fn clone(&self) -> Output

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Output

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for Output

Auto Trait Implementations§

§

impl Freeze for Output

§

impl RefUnwindSafe for Output

§

impl Send for Output

§

impl Sync for Output

§

impl Unpin for Output

§

impl UnwindSafe for Output

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.