Skip to content
UrushiDocumentation

CLI overview

Urushi’s CLI surface is for output that is written once and then returns control to the command. It ranges from styling one line to composing a complete result from panels, lists, tables, trees, and CLI-specific presentations.

It does not enter raw mode or install an event loop. Use urushi-prompt when the command must ask for input, and urushi-tui when it owns a continuously redrawn screen.

For explicit coordinates, overlap, and connected lines, compose the result with Canvas. urushi-cli adds the opinionated Summary and Warning language; core urushi supplies the underlying styles, layout, and components.

Run the complete CLI quickstart ↓

All of these paths produce either StyledText or a renderer-neutral View. That keeps layout and meaning separate from the final terminal capabilities.

From command result to output

Choose a presentation layer, produce one shared View, then let the output destination select ANSI or plain text.

Domain-specific presentation

  1. dataContent and meaningText, data, and command result
  2. compose
    processCore urushiStyles, layout, and components
  3. produce
    dataViewRenderer-neutral presentation
  4. resolve + render
    actorOutput destinationTerminal ANSI or redirected plain text

Opinionated CLI presentation

  1. dataSemantic resultSummary or warning data
  2. present
    processurushi-cliShared rails, glyphs, hierarchy, and roles
  3. produce
    dataViewThe same renderer-neutral value
  4. resolve + render
    actorOutput destinationTerminal ANSI or redirected plain text

This example uses the opinionated layer to turn semantic result data into a view, then sends that view through the ordinary static-output path:

Terminal window
cargo new result-demo
cd result-demo
cargo add urushi urushi-cli
use std::io;
use urushi::ThemePreset;
use urushi_cli::{CliTheme, Summary};
fn main() -> io::Result<()> {
let theme = ThemePreset::get("Catppuccin Mocha")
.expect("built-in theme")
.theme();
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)
}
│
◇  Build complete
│  Target   aarch64-apple-darwin
│  Profile  release
│  Output   target/release/app

The same output pipeline can render a view assembled directly from core layout primitives or from a reusable list, table, or tree presentation.

Use urushi directly when the application’s structure is specific to its domain. It supplies styles, themes, layout, components, measurement, rendering, and standard-stream helpers without imposing a product vocabulary.

Add urushi-cli when multiple commands should share a recognizable human-facing language. Its semantic data remains independent of color and width, and its presentations still return ordinary View values that can be combined with core layouts.