1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! 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 of short rows as aligned columns under
//! a header, the listing module frames a list with the fields placing it and
//! the errors of its items, the capability module prints what an account
//! serves, the records module a list of wide items the way `git log`
//! prints commits, and the sanitize module defuses untrusted text before
//! any of them 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,
//! and the signal module the termination signals a long-lived command
//! stops cleanly on.
//! The build module exposes helpers for build scripts.