pub struct Shell { /* private fields */ }
Expand description

An abstraction around console output that remembers preferences for output verbosity and color.

Implementations

Creates a new shell (color choice and verbosity), defaulting to ‘auto’ color and verbose output.

Creates a shell from a plain writable object, with no color, and max verbosity.

Sets whether the next print should clear the current line.

Returns true if the needs_clear flag is unset.

Returns the width of the terminal in spaces, if any.

Returns true if stderr is a tty.

Gets a reference to the underlying stdout writer.

Gets a reference to the underlying stderr writer.

Erase from cursor to end of line.

Shortcut to right-align and color green a status message.

Shortcut to right-align a status message.

Runs the callback only if we are in verbose mode.

Runs the callback if we are not in verbose mode.

Prints a red ‘error’ message.

Prints an amber ‘warning’ message.

Prints a cyan ‘note’ message.

Updates the verbosity of the shell.

Gets the verbosity of the shell.

Updates the color choice (always, never, or auto) from a string..

Gets the current color choice.

If we are not using a color stream, this will always return Never, even if the color choice has been set to something else.

Whether the shell supports color.

Write a styled fragment

Caller is responsible for deciding whether Shell::verbosity is affects output.

Prints a message to stderr and translates ANSI escape code into console colors.

Prints a message to stdout and translates ANSI escape code into console colors.

Trait Implementations

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.