Expand description
Shared building blocks for the Pimalaya command-line tools. Published for internal Pimalaya usage: the API follows the needs of its consumers (himalaya, neverest, cardamum, calendula and friends) and may change without notice. Third parties should treat it as private; the io-* protocol crates and pimalaya-stream are the supported surface.
This crate factors out the pieces every Pimalaya CLI would otherwise reimplement: argument parsing glue, output rendering, logging and interactive prompts. Each piece sits behind its own cargo feature, so a binary pulls in only what it uses.
Unlike the io-* protocol libraries this crate is deliberately std: it exists to talk to a terminal, a filesystem and a human, so it never targets no_std.
The clap module wires shared arguments and the completion, manual and JSON Schema commands into a binary’s parser. The printer and error modules render command output, events and failures to stdout, the output module holds the shapes every binary shares (bytes, pages), and the log module initializes the logger.
Text output is plain text: no border, no colour, nothing sized to the
terminal. The fields module lays a record out as aligned Label: value
lines, the columns module a list as aligned columns under a header,
and the sanitize module defuses untrusted text before either prints
it.
A binary has no setup wizard: on a first run, the welcome module tells a person which configuration file is missing and prints the commands creating it from the sample shipped next to the binary, then the first command to run. The shell module quotes such commands for a paste.
A binary keeping one account open across commands runs a session over its stdin: the repl module reads one command per line with the binary’s own grammar, the mcp module answers Model Context Protocol requests, its tools derived from that grammar or written by hand, and the session module keeps the commands they run off stdin.
The prompt and spinner modules handle interactive input and progress. The build module exposes helpers for build scripts.
Modules§
- build
build - Helpers for binary build scripts.
- clap
terminal - Shared clap building blocks: arguments, value parsers and the ready-made completion and manual generation commands.
- columns
terminal - Text lists printed as aligned columns.
- error
terminal - Command failure reporting to stdout.
- fields
terminal - Text records printed as aligned fields.
- log
terminal - Logger initialization from the shared log flags.
- mcp
mcp - A Model Context Protocol server over stdio: the JSON-RPC answers every server gives alike, and the tool results built from what a command prints.
- output
terminal - Output shapes shared by every binary.
- printer
terminal - Command output rendering to stdout.
- prompt
prompt - Interactive prompt helpers wrapping the inquire crate.
- repl
repl - A read-eval-print loop over stdin, running a binary’s own commands against what a session keeps open.
- sanitize
terminal - Untrusted text made safe to print on a terminal.
- session
mcporrepl - The stdin of a session.
- shell
terminal - Commands printed for a person to paste into a shell.
- spinner
spinner - Lightweight terminal spinner built on crossterm.
- welcome
terminal - The welcome a person meets on a first run.
Macros§
- footer
terminal - Builds the –help footer, with link to bug tracker and sponsor.
- long_
version terminal - Builds the long version string (version, enabled features, build
target and git revision) for a binary’s
--versionoutput.