Standardize responsive table layouts across azd commands#8785
Conversation
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors PrettyTableFormatter to provide a consistent, responsive table/card rendering model across multiple azd commands (extensions, tools, templates, and other tabular outputs), aligning column ordering/labels and making narrow-width behavior more readable.
Changes:
- Split the pretty-table implementation into focused files (types, table rendering, card rendering, layout logic) and added a 3-breakpoint responsive model with truncation/wrapping and optional “Showing N of M columns” hints.
- Updated
azd extension list,azd tool check,azd tool list,azd template list, and related list commands to opt into the standardized responsive behavior and new column conventions. - Added/updated tests to cover truncation, wrapping, column fitting/shrink order, card-title behavior, and responsive hint output.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/output/pretty_table.go | Refactors formatter entrypoint to use parsed columns + breakpoint resolution and delegates rendering to new helpers. |
| cli/azd/pkg/output/pretty_table_types.go | Introduces responsive-table types/constants (breakpoints, column metadata, options). |
| cli/azd/pkg/output/pretty_table_table.go | Adds table rendering with column fitting, truncation tracking, and optional responsive hints/hidden-column placeholder. |
| cli/azd/pkg/output/pretty_table_layout.go | Implements width calculations, truncation/wrapping, and hint message construction. |
| cli/azd/pkg/output/pretty_table_cards.go | Reworks card rendering (grouped headers, borderless titled cards, legacy boxed cards fallback). |
| cli/azd/pkg/output/pretty_table_test.go | Updates existing pretty-table unit tests to match the new compact/full behavior. |
| cli/azd/pkg/output/pretty_table_responsive_test.go | Adds comprehensive tests for truncation, wrapping, shrink-order, column hints, card-title layouts, and color retention. |
| cli/azd/cmd/tool.go | Updates tool list / tool check pretty-table column configs to match the standardized responsive behavior and status vocabulary. |
| cli/azd/cmd/templates.go | Switches template list to forced card layout with new/reordered fields (including repository + source). |
| cli/azd/cmd/extension.go | Updates extension list columns to show INSTALLED/LATEST and applies the standardized responsive behaviors + simplified status vocabulary. |
| cli/azd/cmd/extension_test.go | Removes symbol-only status tests and adjusts color tests for trimmed/padded input tolerance. |
| cli/azd/cmd/copilot.go | Removes permission symbol substitution and enables responsive column hints for the consent list table. |
| cli/azd/cmd/config.go | Enables responsive column hints for config options table output. |
| cli/azd/.vscode/cspell.yaml | Adds new formatter-related terms to the cspell allowlist. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 2
hemarina
left a comment
There was a problem hiding this comment.
Clean, well-structured refactor. Splitting the monolithic pretty_table.go into _types / _layout / _table / _cards makes the responsive model much easier to follow, the ShortValueTemplate/symbol mechanism is fully removed, JSON output is preserved (all dropped struct fields were json:"-"), and the new responsive/unit tests give good coverage (narrow-width termination, color preservation, fit/shrink ordering). Build passes.
Nit (non-blocking)
- Dead case in
toolStatusColor(cmd/tool.go). After the symbol removal, the STATUS column only ever passes"Installed"/"Not installed", so the"✓"arm incase "Installed", "✓":is unreachable. Safe to drop for clarity.
Nicely handled
colorLineLikeValuekeeps a truncated cell colored by classifying from the full value and transplanting the escape pre/suffix onto the visible line, with a sensibleNO_COLORshort-circuit.fitColumnsshrinking least-important-first (highest priority, then right-most) with per-column floors that never truncate headings is a clean model.- The
···hidden-column placeholder + "Showing N of M columns" hint makes column dropping non-silent across all tabular commands.
jongio
left a comment
There was a problem hiding this comment.
Solid refactoring. The decomposition of the monolithic pretty_table.go into five focused modules (types, layout, table, cards) is clean, and the responsive engine with smart truncation/wrapping is well-designed. The test coverage in pretty_table_responsive_test.go (566 new lines covering edge cases like degenerate widths, CJK runes, and color preservation through truncation) gives confidence in the new behavior.
The colorLineLikeValue approach for preserving color classification on truncated cells is clever and handles the fallback case correctly.
One minor dead-code nit below; otherwise this looks good to ship.
jongio
left a comment
There was a problem hiding this comment.
New commit e2fb7f9 cleanly addresses two simplifications:
- Removing
-o tablefromazd config options(the responsive engine renders this command better as cards/default already) - Dropping the leading
⟳symbol from "Update available" and removing the now-unnecessarystrings.TrimSpaceinextensionStatusColor
Both changes are internally consistent: the test cleanup matches the removed code paths, and the snapshot update is correct.
My prior nit about the dead "✓" match arm in toolStatusColor (tool.go:1564) still applies. Also noting that toolStatusColor still uses strings.TrimSpace while extensionStatusColor just dropped it. Since ColorFunc is always called with the raw value (via colorLineLikeValue), the TrimSpace in toolStatusColor is equally unnecessary. Minor consistency point for a follow-up cleanup.
LGTM on the incremental changes.
jongio
left a comment
There was a problem hiding this comment.
Solid work. The responsive table engine is well-decomposed across focused files (types, layout, table, cards) and the breakpoint system (full/compact/card) gives a clean, consistent UX across all tabular commands.
Checked against the latest commit (0f728be) which addressed my prior nit about the dead "✓" arm. Everything looks good now.
Highlights:
- The
colorLineLikeValueapproach for preserving color classification on truncated text is clever and correct: color is determined from the full value, then the escape sequences are transferred to the visible (truncated) line. - Edge case coverage is thorough: wide runes, degenerate widths, escape-bearing values, and the
wrapWordsinfinite-loop fix for sub-rune widths. ForceCardsfortemplate listis the right call since templates have long URLs that don't fit tabular layouts.- The removal of
azd config options -o tableis justified; the stacked key-value list is more readable for config metadata.
No blocking issues found. LGTM from a code quality perspective.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Fixes #8667
Fixes #8634
Fixes #8669
Fixes #8670
Fixes #8686
Fixes #8772
This PR standardizes the responsive table experience for
azd extension list,azd tool check,azd tool list, andazd template list, addressing the child issues (#8634, #8669, #8670, #8686) of the table-standardization epic (#8667). These commands previously had inconsistent column ordering, labels, and degraded poorly at narrower terminal widths.The shared
PrettyTableFormatterengine is refactored to drive a single, consistent responsive model with three width breakpoints: at full width all columns are shown (truncating lower-priority values with an ellipsis only when needed), at medium width the lowest-priority columns are hidden behind a···indicator with a "Showing N of M columns" hint, and at narrow width each row renders as a readable card. Column behavior is opt-in per command (truncation, two-line name wrapping, and card titles), so commands that don't adopt these behaviors are unaffected.Alongside the redesign,
azd extension listnow shows separateINSTALLEDandLATESTversion columns, andazd template listrenders as cards with a dedicatedSOURCEfield. Status values are simplified to plain text distinguished by colour only — there are no longer any status symbols, and "Up to date", "Update available", "Incompatible", and "Not installed" all render as plain coloured text with consistent casing acrosstool listandtool show. The···hidden-column indicator and "Showing N of M columns" hint are also extended to the other tabular commands (extension source list,template source list, andcopilot consent list) so column dropping is never silent. The now-redundantShortValueTemplatemechanism is removed;copilot consent listprints the full colour-coded permission text instead of a symbol. Finally,azd config optionsdrops its-o tableoutput, which rendered poorly and overflowed; it now supports the default stacked list and-o jsononly.Screenshots
azd extension listazd tool checkazd tool listazd template listOther commands (
···hint)