Struct cargo::core::shell::Shell

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

An abstraction around a Writeable object that remembers preferences for output verbosity and color.

Implementations

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

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

Returns the width of the terminal in spaces, if any

Returns whether stderr is a tty

Get a reference to the underlying writer

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

Shortcut to right-align a status message.

Run the callback only if we are in verbose mode

Run the callback if we are not in verbose mode.

Print a red ‘error’ message

Print an amber ‘warning’ message

Update the verbosity of the shell

Get the verbosity of the shell

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

Get 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.

Prints a message 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.

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.