feat: Upgrade 7 CLI list commands to responsive PrettyTableFormatter#8144
Conversation
fc0b3de to
1f2068d
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the responsive output.PrettyTableFormatter (full/compact/card layouts) to additional “list-style” azd commands, aiming to make table output consistent and readable across varying terminal widths while keeping JSON output unchanged.
Changes:
- Migrates several commands from
output.TableFormattercolumns tooutput.PrettyTableFormatterwith prioritized columns and card grouping. - Adds compact-mode symbols + color functions for tool status, tool update availability, and copilot consent permissions.
- Updates config options table test assertions for the new uppercase table headings.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/cmd/tool.go | Switches azd tool list and azd tool check to PrettyTableFormatter, adds compact symbols and shared color helpers. |
| cli/azd/cmd/templates.go | Switches azd template list and azd template source list to PrettyTableFormatter, adds card grouping and column priorities. |
| cli/azd/cmd/extension.go | Switches azd ext source list to PrettyTableFormatter with card grouping by type. |
| cli/azd/cmd/copilot.go | Switches azd copilot consent list to PrettyTableFormatter, adds permission symbols and color formatting. |
| cli/azd/cmd/config.go | Switches azd config options table output to PrettyTableFormatter with card grouping by key. |
| cli/azd/cmd/config_options_test.go | Updates table-format assertions to match new uppercase headings. |
jongio
left a comment
There was a problem hiding this comment.
Clean mechanical rollout of PrettyTableFormatter to the remaining 7 list commands. Each command follows the same structure: Kind() guard, local PrettyTableFormatter, priority-based columns with color helpers, JSON fallback via else branch. Pattern matches the reference from PR #8091.
Verified:
- All 6 commands with
--outputsupport have properKind() == TableFormatguards (config options handles JSON separately above the table block) - Color helpers (
toolStatusColor,updateAvailableColor,consentPermissionColor) follow the establishedextensionStatusColorpattern - Column priorities are reasonable for terminal width degradation
- Test updated for header casing change
On the OSC-8 hyperlink concern (templates.go): displayWidth only strips CSI color codes, not OSC-8 sequences, so templates.Hyperlink output would misalign columns. However, the old TableFormatter (text/tabwriter) had the same limitation - tabwriter counts all bytes between tabs for alignment. This isn't a regression from this PR. Worth fixing in displayWidth as a follow-up if hyperlink usage expands.
|
Fixed — updated |
8f14e0a to
cedea4f
Compare
- Upgrade config options, copilot consent list, ext source list, template list, template source list, tool list, and tool check to PrettyTableFormatter - Add responsive breakpoints (full/compact/card) with column priorities - Add color-coded status/permission values with short symbol templates - Add DESCRIPTION and TAGS columns to template list for richer output - Fix OSC-8 hyperlink escape sequence handling in displayWidth - Add card-mode grouping by natural category columns Resolves Azure#8145 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cedea4f to
a8bbe72
Compare
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
jongio
left a comment
There was a problem hiding this comment.
Updated review after force-push. The cmd/ changes are identical to what I reviewed before - no issues there.
New in this push: displayWidth now strips OSC-8 hyperlink sequences before measuring column widths. The fix is clean:
- osc8Regex handles both ST and BEL terminators
- Stripping order is correct (OSC-8 first, then ANSI color codes) since OSC-8 contains ESC bytes that would otherwise confuse the ANSI regex
- 4 test cases cover the key variants (ST, BEL, combined with ANSI, plain text)
This addresses the pre-existing displayWidth limitation I noted in my earlier review. Hyperlink columns in template list will now align correctly.
jongio
left a comment
There was a problem hiding this comment.
Addresses my earlier feedback on OSC-8 handling. The displayWidth fix is correct - strips hyperlink sequences before measuring, with both ST and BEL terminator support. Test coverage looks good. The cmd/ changes are unchanged from my first review - clean pattern rollout.
Resolves #8145
Summary
Extends the responsive
PrettyTableFormatterpattern (introduced forazd ext listin #8091) to all remaining list-style commands. This provides consistent, responsive table output across the CLI with:Responsive Breakpoints
The
PrettyTableFormatterautomatically adapts output based on terminal width:ShortValueTemplateused where defined (e.g., "Up to date" becomes a checkmark symbol)CardGroupColumn(e.g., grouped by CATEGORY, SOURCE, SCOPE)Column Priority System
Each column is assigned a priority level that controls visibility at different widths:
Thresholds
Default thresholds are
FullThreshold: 100andCompactThreshold: 60. These can be customized per-command viaPrettyTableFormatterOptions, though all 7 commands in this PR use the defaults.Commands Upgraded
azd ext source listazd tool listazd tool checkazd template listazd template source listazd copilot consent listazd config optionsExpected Output Examples
azd tool list- Full Width (>= 100 chars)Status values are color-coded: green for "Installed", yellow for "Not Installed".
azd tool list- Compact Width (60-99 chars)In compact mode, Priority 3 columns (ID, PRIORITY) are hidden and STATUS uses a short symbol:
azd tool list- Card Layout (< 60 chars)Cards are grouped by CATEGORY:
azd copilot consent list- Full WidthPermission values are color-coded: green for "allow", red for "deny", yellow for "prompt".
azd copilot consent list- Card Layout (< 60 chars)Cards are grouped by SCOPE:
azd config options- Card Layout (< 60 chars)With 7 columns, card mode is especially useful:
Shared Patterns
Three color helper functions were created (no duplication):
toolStatusColor()- green for Installed, yellow for Not InstalledupdateAvailableColor()- yellow for Yes, green for NoconsentPermissionColor()- green for allow, red for deny, yellow for promptAll follow the same pattern as the reference
extensionStatusColor()from #8091.Related
azd ext listtable #7287 - Originalazd ext listreadability issuePrettyTableFormattertemplate listis illegible in any size terminal #2198 - "template listis illegible in any size terminal"Testing
go build ./...)go test ./cmd/...)go test ./pkg/output/...)