Repository navigation
feat(cli): draw context and auth status as cards on a terminal - #107
Conversation
tee8z
left a comment
There was a problem hiding this comment.
Review of 799b6db (base #106 01ff3ef). This is not an approval yet, because nothing has validated this head: CI has not run on it, and I have not run the gate or the CRAP report. The code review found no bugs:
cardis#[serde(skip)], so JSON, NDJSON and--output-fileoutput are unchanged, and cards also require stdout to be a terminal.- Width is measured on the text without styles, every row is
inner + 4wide, andinner - title.len() - 1cannot underflow. - A card that does not fit falls back to the plain lines, and
Glyphs::ASCIIdraws ASCII frames. - The cards show no new data: they read no secret and make no network request.
One nonblocking note: the description includes a real @voltage.cloud email address. Please replace it with a placeholder such as you@example.com, as #106 does.
I will approve once CI or my local gate passes on this head.
799b6db to
62ef90c
Compare
On a terminal, voltage context and voltage auth status draw their field lines inside a box titled in Voltage orange, with rounded corners (or +-| without a UTF-8 locale), bold field names, and dimmed sources. Widths are measured without styles. A card wider than the terminal, and any redirected output, keeps the plain field lines.
62ef90c to
d5bd5fa
Compare
tee8z
left a comment
There was a problem hiding this comment.
Approved d5bd5fa, a rebase onto #106 4e764c3. The patch matches 799b6db, where my review found no bugs. card is #[serde(skip)], cards need stdout on a terminal, the width math cannot underflow, a card that does not fit falls back to plain lines, and nothing new is read or requested. Validation on this head, in nix develop: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked (175 unit, 134 integration) and python3 scripts/check-coverage.py passed. CRAP: 758 measured functions, none at or above 20, highest wait_for_payment at 17.05. CI is green. My earlier note still applies: please replace the real @voltage.cloud email address in the description with a placeholder.
|
Correction to my approval: the description no longer contains the email address, so there is nothing to change there. Thanks. |
Stack position: 8 of 13 in the look-and-feel stack. Base:
feat/cli-look-07-wordmark(#106).Problem
voltage contextandvoltage auth statusanswer "who am I and where am I pointed?", the question a person checks most often. Their output was the same plain field list as any API result, with nothing to frame it.Behavior
On a terminal (stdout is a TTY, table output):
contextthe(flag)/(environment)sources are dim. The borders are dim.+,-, and|.contextwith long config paths is about 104 columns wide, so it shows as a card only on wide terminals.--output table | cat) and JSON are unchanged.Design notes
Envelope::titled(title)(serde-skippedcardfield) marks a result for a card. Onlycontextandauth statusset it.human::Viewgainscards(stdout is a TTY),glyphs, anddepth.card()measures each line's display width with styles stripped, so styled lines and borders line up. Borders and the title are painted after layout.Try it on staging
Setup: Try a pull request on staging (added by #97).
Expect: both drawn in a rounded box titled
voltage auth status/voltage contextin orange. Make the terminal at least ~105 columns wide forcontext; narrower, it shows the plain lines.LANG=C LC_ALL=C voltage auth status --account me COLUMNS=30 voltage auth status --account me voltage auth status --account me --output table | cat voltage auth status --account me --jsonExpect: an ASCII
+- voltage auth status -+box; then plain lines (too narrow); then plain lines (redirected); then JSON, unchanged.Validation
cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata,cargo test --locked(161 unit and 127 integration tests), andpython3 scripts/check-coverage.pyall pass.context --output table --color alwayshas plain field lines and no card.src/cli.rsendpoint, untouched).Docs
docs/reference/output.mdandCHANGELOG.md.