spruce/message
Semantic one-line messages: success, fail, start, ready, info, warn, error.
Each function returns a formatted line (icon + label + text), indented to
the context’s depth and styled when the context supports color. The
print_* variants write the line to stdout.
Types
The kind of semantic message, selecting its icon, color, and label.
pub type Kind {
Success
Fail
Start
Ready
Info
Warn
Error
}
Constructors
-
Success -
Fail -
Start -
Ready -
Info -
Warn -
Error
Values
pub fn badge() -> Formatter
Render the message prefix as an uppercase bracketed badge, e.g. [SUCCESS].
pub fn custom(
render: fn(Kind, spruce.Spruce) -> String,
) -> Formatter
Render the message prefix with a caller-supplied function.
pub fn error_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format an error message line with explicit rendering options.
pub fn fail_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format a fail message line with explicit rendering options.
pub fn info_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format an info message line with explicit rendering options.
pub fn label() -> Formatter
Render the message prefix as icon plus lowercase label, e.g. ✔ success.
pub fn line_with(
sp: spruce.Spruce,
kind: Kind,
text: String,
options: Options,
) -> String
Format a message line with explicit rendering options.
pub fn print_error(sp: spruce.Spruce, text: String) -> Nil
Print an error message to stdout.
pub fn print_fail(sp: spruce.Spruce, text: String) -> Nil
Print a fail message to stdout.
pub fn print_info(sp: spruce.Spruce, text: String) -> Nil
Print an info message to stdout.
pub fn print_ready(sp: spruce.Spruce, text: String) -> Nil
Print a ready message to stdout.
pub fn print_start(sp: spruce.Spruce, text: String) -> Nil
Print a start message to stdout.
pub fn print_success(sp: spruce.Spruce, text: String) -> Nil
Print a success message to stdout.
pub fn print_warn(sp: spruce.Spruce, text: String) -> Nil
Print a warn message to stdout.
pub fn ready_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format a ready message line with explicit rendering options.
pub fn simple() -> Formatter
Render the message prefix as an uppercase bare label, e.g. SUCCESS.
pub fn start_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format a start message line with explicit rendering options.
pub fn success(sp: spruce.Spruce, text: String) -> String
Format a success message line.
pub fn success_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format a success message line with explicit rendering options.
pub fn warn_with(
sp: spruce.Spruce,
text: String,
options: Options,
) -> String
Format a warn message line with explicit rendering options.
pub fn with_details(
options: Options,
details: details.Details,
) -> Options
Include key-value details after the message text.
pub fn with_formatter(
options: Options,
formatter: Formatter,
) -> Options
Select a message prefix formatter.
pub fn with_symbol_mode(
options: Options,
mode: symbol.Mode,
) -> Options
Select whether message status glyphs render as Unicode or ASCII.