Skip to main content

Module ui

Module ui 

Source
Expand description

Terminal output substrate for largo.

Central home for everything user-facing that is not command logic: the CliError type rendered by the binary’s main, the process exit-code conventions, the color/verbosity state shared by every command, and the clap help palette.

All commands construct CliError (directly or via CliError::new / CliError::with_hint) instead of ad-hoc string errors when they want a hint line or a non-default exit code. Plain String errors continue to work through Box<dyn Error> and render without a hint.

Every user-visible print goes through [anstream], so ANSI styling is automatically stripped on pipes, honored under --color always, and silenced by NO_COLOR — including styling embedded in engine-rendered messages that pass through here.

Structs§

CliError
A user-facing CLI error: a message, an optional help: hint, and the exit code the process should terminate with.

Enums§

ColorMode
The --color mode selected on the command line.

Constants§

CLAP_STYLES
The cargo help palette for clap: bold-green headers/usage, bold-cyan literals, cyan placeholders.
ERROR_STYLE
Bold red — the error: prefix.
EXIT_FAILURE
Process exit code for a command failure (build error, proof failure, dirty fmt --check, parse error, …).
EXIT_OK
Process exit code for success.
EXIT_USAGE
Process exit code for a usage error (bad arguments, reserved verb). Matches clap’s own convention for argument errors.
HELP_STYLE
Bold cyan — the help: prefix.
PHASE_STYLE
Bold green — phase headers (Compiling, Finished, …), cargo-style.
WARN_STYLE
Bold yellow — the warning: prefix.

Functions§

info
Print an informational line to stdout unless --quiet is active.
init
Install the global output state from the parsed CLI flags.
is_quiet
Whether --quiet was passed: informational output should be suppressed.
phase
Print a cargo-style phase header (right-aligned bold-green verb) to stderr unless --quiet is active.
render_error
Render any top-level error to stderr in the error:/help: style and return the exit code the process should use.
verbosity
The -v count: 0 normal, 1+ increasingly chatty.