Skip to content
UrushiDocumentation

CLI presentations

urushi-cli provides an opinionated visual language for non-interactive, human-facing command output. It owns CLI-specific structure such as rails, status glyphs, title hierarchy, and semantic roles while composing everything into ordinary Urushi View values.

The 0.1.0 release starts with Summary and Warning. They are the currently available presentations, not the complete scope of the crate. urushi-cli does not define logging levels, prompts, live progress, or a full-screen runtime.

Terminal window
cargo add urushi urushi-cli
Cargo.toml
[dependencies]
urushi = "0.1.0"
urushi-cli = "0.1.0"

CliTheme derives its body, muted, accent, and warning roles from a core Theme. The resulting components therefore match output from other Urushi surfaces.

use urushi_cli::CliTheme;
let cli = CliTheme::from_theme(&theme);

The mapping uses the core theme’s body, muted, accent, and warning tokens:

│ muted rail
◇ accent status
│ Label  body value
use urushi_cli::{CliTheme, Summary};
let cli = CliTheme::from_theme(&theme);
let view = cli.summary(
&Summary::new("Build complete")
.field("Target", "aarch64-apple-darwin")
.field("Profile", "release")
.field("Output", "target/release/app"),
);
urushi::println_view(&view)?;

The canonical summary uses a vertical rail, a status glyph, and aligned field labels:

│
◇  Build complete
│  Target   aarch64-apple-darwin
│  Profile  release
│  Output   target/release/app

The component returns an ordinary View. It reflows labels and values when the available terminal width changes, including CJK labels and values.

use urushi_cli::Warning;
let view = cli.warning(&Warning::new(
"Existing file",
"The previous report will be replaced.",
));
urushi::eprintln_view(&view)?;
│
▲  Existing file
│  The previous report will be replaced.

Warnings are presentation, not delivery policy. Decide in the application whether a message goes to stdout, stderr, a logger, or nowhere.

Use CliTheme::style when the canonical mapping needs one surface-specific adjustment.

use urushi::{Color, TextStyle};
use urushi_cli::CliRole;
let cli = CliTheme::from_theme(&theme).style(
CliRole::Warning,
TextStyle::new().foreground(Color::BRIGHT_YELLOW).bold(),
);

The override changes the warning role while leaving the rail and body roles unchanged:

│
▲  Existing file
│  The previous report will be replaced.

Keep the core Theme as the default source of truth. Override a CLI role only when that semantic role genuinely differs on this surface.

See the CLI reference for every role, presentation, output helper, and default.