feat(tpagectl): add table rendering improvements #604
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!604
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/tpagectl-table-improvements"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements Phase 7 table rendering improvements (roadmap #273).
output.RenderTable— shared bysite list,deployment list, andpreview list, replacing their three hand-rolledtabwriterhelpers.golang.org/x/termon the writer's own fd (deterministic: no stdout/fallback coupling). Columns are shrunk to fit the terminal with a per-column floor, and cells are word-wrapped (long URLs hard-split). When output is redirected/piped (not a terminal), tables render byte-identical to before.--no-headers(#271) — omits the header row from table output on all three list commands.--sort <column>(#272) — stable sort by column before rendering (also applies to--format json/yaml):site list→ name/owner/status/domain/url;deployment list→ version/commit/deployed/status;preview list→ branch/path/status/deployed.deployedsorts by timestamp. Unknown columns return a validation error (exit 5). No--sortkeeps server order (no behavior change).Why
Roadmap task #273.
Testing
outputtests: plain table byte-identical to tabwriter;NoHeadersdrops the header; forced-width wrap keeps every line within the budget;wrapCellword-wrap and long-word hard-split;columnBudgetsshrink within available width;terminalWidth(bytes.Buffer) == 0--no-headerson all three lists;--sortordering via index checks (site name/owner/status, deployment version/deployed, preview branch/deployed); invalid--sort→ "invalid sort column"go test -race ./...passes (27 packages)golangci-lint runcleanBreaking Changes
None. Non-terminal table output is byte-identical;
--sort/--no-headersare additive flags.Notes
golang.org/x/termpromoted from indirect to direct dependency (already vendored); no new packages added.Closes #270
Closes #271
Closes #272
Closes #273
Clean consolidation.
RenderTableshares one tabwriter path with byte-identical non-terminal output (sametabwriterparams as the three hand-rolled writers), the wrapped path is sound (rune-count budgets, word-wrap with hard-split for long URLs, per-column minimum floor, stable sorting), and--no-headers/--sortare wired consistently across all three list commands with validation errors mapping to exit 5.golang.org/x/termpromoted correctly with no vendor change. Approving; one low-priority finding filed.Suggestions
internal/tpagectl/deployment/list.go:84–--limittruncates before--sort, so--sortonly reorders the already-limited subset and cannot select the top N across the full set (--limit 5 --sort deployedpicks the first 5 in server order, then sorts them). Sort first, then limit. Filed as #605.Questions
v10sorts beforev2). Natural sort would be more intuitive for version columns; fine as a CLI tradeoff?availis clamped ton*8even when that exceeds the terminal width, so wrapped output can still overflow. Commented as an intentional tradeoff — confirming it's acceptable.Praise
cols < 20treated as non-terminal, keeps piped output byte-identical — verified by the existing substring tests passing unchanged.wrapCellcorrectly handles words longer than the budget without losing content (the long-URL case is covered by a test).