Fix confusing error message for unsupported output format; remove plain-text as advertised format#11220
Fix confusing error message for unsupported output format; remove plain-text as advertised format#11220
Conversation
…thout plain-text Co-authored-by: brooke-hamilton <45323234+brooke-hamilton@users.noreply.github.com>
|
@copilot fix this. There should not be help text saying that |
…onsistent error messages Co-authored-by: brooke-hamilton <45323234+brooke-hamilton@users.noreply.github.com>
Fixed in a924a54. Added |
|
@copilot does the same fix need to be applied to other commands? |
No, the fix already covers all commands. |
|
@copilot apply changes based on the comments in this thread |
…n test file Co-authored-by: brooke-hamilton <45323234+brooke-hamilton@users.noreply.github.com>
Applied both changes in 6f65972:
|
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Description
This PR improves the CLI output format handling by:
json,table).plain-textas an advertised output format —plain-textwas only accepted byrad recipe-pack showand produced output identical totable. It is no longer shown in help text or flag descriptions.--output plain-text(e.g. in scripts) will silently get table-formatted output instead of an error.Changes
Output format normalization
NormalizeFormat()inpkg/cli/output/formats.gothat maps"plain-text"→"table"FormatPlainTextcase inNewFormatter()that returnsTableFormatter(defense in depth)Unified validation
RequireOutput()inpkg/cli/clivalidation.goto normalize"plain-text"→"table"before validationRequireOutputAllowPlainText()andrequireOutputFromFormats()— no longer neededAddOutputFlagWithPlainText()frompkg/cli/cmd/commonflags/flags.goCommand updates
rad recipe-pack show: switched fromAddOutputFlagWithPlainText+RequireOutputAllowPlainTextto standardAddOutputFlag+RequireOutputrad version: switched from manual flag reading tocli.RequireOutput()for consistent validation; registered output flag viacommonflags.AddOutputFlag(cmd)inNewCommand()Tests
Test_RequireOutput:"plain-text"now expects"table"(not an error)Test_RequireOutputAllowPlainText(function deleted)pkg/cli/output/formats_test.go— tests forNormalizeFormatpkg/cli/output/formatter_test.go— tests forNewFormatterincluding"plain-text"casepkg/cli/cmd/recipepack/show/show_test.goBackwards Compatibility
rad app list -o jsonrad app list -o tablerad app list -o plain-textrad app list -o textrad app list --helprad recipe-pack show X -o plain-textrad recipe-pack show X -o tablerad recipe-pack show --helpKey point:
"plain-text"was never meaningfully different from"table"— it always produced the same output. This change makes the CLI consistent while ensuring existing scripts continue to work.Type of change
Contributor checklist
Please verify that the PR meets the following requirements, where applicable:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.