spruce/message

Semantic one-line status messages: success, fail, start, ready, info, warn, and error.

Each function returns a block with a colored icon, a bold label, and the text. Every non-empty line is indented to the context’s depth, and output is plain when the context does not support color. They are sugar for the common cases; for timestamps, scopes, key-value details, RFC 5424 severities, or badge/simple prefixes, compose a spruce/line instead. Print with gleam/io (or collect blocks with spruce/output).

import gleam/io
import spruce
import spruce/message

pub fn main() {
  let context = spruce.detect()
  io.println(message.start(context, "compiling"))
  io.println(message.success(context, "done"))
}

Values

pub fn error(context: spruce.Spruce, text: String) -> String

Format an error message line, e.g. ✖ error could not reach registry.

pub fn fail(context: spruce.Spruce, text: String) -> String

Format a fail message line, e.g. ✖ fail 1 test failed.

pub fn info(context: spruce.Spruce, text: String) -> String

Format an info message line, e.g. ℹ︎ info resolving dependencies.

pub fn ready(context: spruce.Spruce, text: String) -> String

Format a ready message line, e.g. ✔ ready listening on :8080.

pub fn start(context: spruce.Spruce, text: String) -> String

Format a start message line, e.g. ◐ start compiling.

pub fn success(context: spruce.Spruce, text: String) -> String

Format a success message line, e.g. ✔ success done.

pub fn warn(context: spruce.Spruce, text: String) -> String

Format a warn message line, e.g. ⚠ warn deprecated option.

✨ Search Document