sparcli
A lightweight, cross-platform toolkit for styled CLI output and
interactive input widgets in Rust. It renders directly to the terminal via
crossterm (no ratatui dependency) but
mirrors ratatui's familiar vocabulary (Style, Color, Span, Line,
Text), so the API feels at home if you already use ratatui.
sparcli is meant for small, lightweight CLI tools: a single accent color, muted
defaults, rounded borders, graceful NO_COLOR and non-terminal behavior. Heavy,
full-screen/retained TUIs are out of scope (that is what ratatui is for).


Highlights
- Output: styled text, markup, tables (colspan, striping, wrap, titles),
panels, alerts, rules, lists, trees, key-value lists, badges, progress bars,
spinners, multi-progress, diffs, columns, live display, pager, and
composition helpers (
align,pad,vstack). - Input: confirm, text (validation, char filters, history, ghost autocomplete), password, number (with a calculator), textarea, single/multi select, an inline fuzzy select, and a calendar date picker.
- Unified theme for input and output, set once and overridable per call.
- Robust: no panics on input, RAII terminal restore,
Result-based errors.
Install
[]
= "0.1"
# Opt-in features (the base stays small):
# sparcli = { version = "0.1", features = ["markup", "fuzzy", "pager"] }
| Feature | Adds |
|---|---|
markup |
[bold red]…[/] inline markup parsing |
fuzzy |
inline fuzzy-select (pulls in nucleo-matcher) |
pager |
paging via $PAGER / less / more |
full |
enables markup, fuzzy and pager |
Output example
use *;
use ;
Every output widget implements Renderable: call .print() to write to stdout,
or .print_to(&mut writer) to capture output. When stdout is not a terminal (a
pipe, a file, or with NO_COLOR), no escape codes are emitted.
Input example
use ;
use non_empty;
Prompts return Outcome<T> (either Submitted(value) or Cancelled) and never
panic. They require an interactive terminal; without one they return
SparcliError::NoTerminal.
Theming
use ;
let theme = Theme ;
set_theme;
The same theme drives both output widgets and input prompts.
Examples
Documentation
API.md— the complete public API in one place.DEVELOPMENT.md— building, testing and contributing.cargo doc --all-features --open— the canonical rustdoc reference.
License
MIT OR Apache-2.0