Route direct-stdout command output through internal/ui (closes #149)
version, info, remote info, config, and database delete wrote plain text straight to stdout, so they were unstyled and ignored --quiet. Output is now governed by internal/ui in two buckets. Status lines and confirmations (config init, config set, the database delete prompt) go through the ui message methods and are silenced by --quiet. The data a command exists to produce is written plain -- the version/info/remote-info reports, the snapshot list table, config get values, and the --json documents -- and is never suppressed, since a script depends on it and a marker would corrupt a table or document. The database delete confirmation prompt is always shown. Pure-cli commands reach ui through a small commandUI helper. Model: opus-4-8
This commit was merged in pull request #201.
This commit is contained in:
@@ -645,17 +645,26 @@ priority.
|
||||
|
||||
## output style
|
||||
|
||||
The operational narration of the long-running commands — the Begin,
|
||||
Complete, Progress, and status lines of `snapshot create`, `prune`,
|
||||
`snapshot restore`, and the like — goes through helpers in `internal/ui`
|
||||
and conforms to the uniform style below. Some commands instead write
|
||||
plain text straight to stdout (`version`, `info`, `config`, the
|
||||
`database delete` prompt, and the `snapshot list` table); that output is
|
||||
unstyled and does not honor `--quiet`. Routing it through `internal/ui`
|
||||
is tracked in
|
||||
[issue #149](https://git.eeqj.de/sneak/vaultik/issues/149). Color is
|
||||
enabled when stdout is a TTY and the `NO_COLOR` environment variable is
|
||||
unset (https://no-color.org/).
|
||||
Every command's user-facing output is governed by `internal/ui`, in one
|
||||
of two ways. Color is enabled when stdout is a TTY and the `NO_COLOR`
|
||||
environment variable is unset (https://no-color.org/).
|
||||
|
||||
* **Status, progress, warnings, and errors** go through the `internal/ui`
|
||||
message methods below: marker-prefixed, colored on a TTY, and — except
|
||||
warnings and errors — silenced by `--quiet`. This is the operational
|
||||
narration of the long-running commands (`snapshot create`, `prune`,
|
||||
`snapshot restore`, and the like) and the confirmations of
|
||||
`config init`, `config set`, and `database delete`.
|
||||
* **The data a command exists to produce** is written plain, with no
|
||||
marker and no color, because a marker would corrupt a table or a
|
||||
parsed document. This covers the `version`, `info`, and `remote info`
|
||||
reports, the `snapshot list` table, `config get` values, and every
|
||||
`--json` document. `--quiet` silences the human reports and tables
|
||||
(`version`, `info`, `remote info`, `snapshot list`) but never the
|
||||
machine-consumed `config get` value or the `--json` documents, which a
|
||||
script depends on. The `database delete` confirmation prompt is also
|
||||
written this way and always shown: it is an interactive exchange the
|
||||
operator must see.
|
||||
|
||||
`internal/ui` writes to stdout; it is the output the user asked for.
|
||||
Structured log records are a different thing and go through
|
||||
|
||||
Reference in New Issue
Block a user