cli: maturity polish — color, error translation, tabwriter consistency
Adds three small but high-leverage presentation tweaks for v0.1: 1. internal/cli/style is a new ~70 LOC package with Pass/Fail/Warn/ Dim/Bold helpers. Each is TTY-gated and obeys NO_COLOR. No external dep. Wired into the doctor PASS/FAIL/WARN status, the "banger:" error prefix on stderr, and the dim 'ready in <elapsed>' line. 2. internal/cli/errors translates rpc.ErrorResponse into user-facing text. operation_failed becomes invisible (the message wins); not_found, already_exists, bad_request, bad_version, unauthorized, unknown_method get short labels; unknown codes pass through. The daemon-attached op_id lands in dim parens — paste into journalctl --grep to find the daemon log line that produced the failure. 3. Tabwriter config converges on (0, 8, 2, ' ', 0) across every list/table command. The vm prune confirmation table picked up the right config; system install + system status switched from bare "key: value\n" lines to tabular form. printVMSpecLine drops its Unicode middle dot for an ASCII '|' so terminals without UTF-8 render cleanly. Tests cover translateRPCError for every code, style helpers no-op on non-TTY and under NO_COLOR. Smoke status greps switch from "key: value" to "key value" to match the new format. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e47b8146dc
commit
71a332a6a1
11 changed files with 358 additions and 28 deletions
|
|
@ -134,8 +134,8 @@ sudo env \
|
|||
sudo touch "$smoke_marker"
|
||||
|
||||
status_out="$("$BANGER" system status)" || die 'system status failed after install'
|
||||
grep -q 'active: active' <<<"$status_out" || die "owner daemon not active after install: $status_out"
|
||||
grep -q 'helper_active: active' <<<"$status_out" || die "root helper not active after install: $status_out"
|
||||
grep -qE '^active +active' <<<"$status_out" || die "owner daemon not active after install: $status_out"
|
||||
grep -qE '^helper_active +active' <<<"$status_out" || die "root helper not active after install: $status_out"
|
||||
|
||||
log 'doctor: checking host readiness'
|
||||
if ! "$BANGER" doctor; then
|
||||
|
|
@ -145,8 +145,8 @@ fi
|
|||
log 'system restart: services should come back cleanly'
|
||||
sudo_banger "$BANGER" system restart >/dev/null || die 'system restart failed'
|
||||
status_out="$("$BANGER" system status)" || die 'system status failed after restart'
|
||||
grep -q 'active: active' <<<"$status_out" || die "owner daemon not active after restart: $status_out"
|
||||
grep -q 'helper_active: active' <<<"$status_out" || die "root helper not active after restart: $status_out"
|
||||
grep -qE '^active +active' <<<"$status_out" || die "owner daemon not active after restart: $status_out"
|
||||
grep -qE '^helper_active +active' <<<"$status_out" || die "root helper not active after restart: $status_out"
|
||||
|
||||
# --- bare vm run ------------------------------------------------------
|
||||
log "bare vm run: create + start + ssh + exec 'echo smoke-bare-ok' + --rm"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue