bgctl: improve usability feedback and flag guidance (part 1)#578
bgctl: improve usability feedback and flag guidance (part 1)#578
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Manifest Changes vs v0.1.0-beta.27base✅ No changes debug✅ No changes crds✅ No changes |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #578 +/- ##
=======================================
Coverage 68.72% 68.73%
=======================================
Files 159 160 +1
Lines 33630 33647 +17
=======================================
+ Hits 23112 23127 +15
- Misses 8989 8990 +1
- Partials 1529 1530 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Improves bgctl CLI usability by making output-format errors and flag help text more actionable, and adds tests + changelog entry to cover the new behavior.
Changes:
- Add
unknownOutputFormatErrorhelper and use it insession,debug, andescalationlist-style commands to include supported-o/--outputchoices in errors. - Clarify
watch --intervalhelp text with Go duration examples, and clarify debug--statehelp text as comma-separated. - Improve
config delete-contextmissing-context error with an actionableget-contextshint, and add/extend unit tests + changelog entry.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/bgctl/cmd/session.go | Improves watch interval help text; upgrades list command unknown-format error to include supported choices. |
| pkg/bgctl/cmd/escalation.go | Upgrades unknown-format errors in escalation list commands to include supported choices. |
| pkg/bgctl/cmd/debug.go | Upgrades unknown-format errors; improves --interval and --state flag guidance. |
| pkg/bgctl/cmd/output_format_error.go | Adds helper for consistent unknown output format errors with supported choices. |
| pkg/bgctl/cmd/output_format_error_test.go | Adds unit tests for the new helper. |
| pkg/bgctl/cmd/config.go | Adds actionable guidance to missing-context error in delete-context. |
| pkg/bgctl/cmd/config_commands_test.go | Extends unit test to assert the new guidance is present. |
| CHANGELOG.md | Documents the CLI usability improvements under Unreleased. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Improves bgctl CLI usability by making output-format errors more actionable, clarifying flag help text, and adding guidance for common config mistakes across the CLI command suite.
Changes:
- Added a shared helper to produce output-format errors that list supported choices, and wired it into
session,debug, andescalationcommands (including object-returning subcommands). - Clarified flag help text for polling intervals (Go duration examples) and debug
--statefiltering (comma-separated). - Improved
config delete-contextmissing-context error guidance and added unit tests + changelog entry.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/bgctl/cmd/session.go | Improves --interval help and uses the new output-format error helper / runtime object writer paths. |
| pkg/bgctl/cmd/debug.go | Improves unknown output-format errors, clarifies --interval and --state help, and validates output formats for object-returning commands. |
| pkg/bgctl/cmd/escalation.go | Improves unknown output-format errors and validates output formats for get. |
| pkg/bgctl/cmd/root.go | Updates global --output/-o help text to include wide and note command-dependent support. |
| pkg/bgctl/cmd/output_format_error.go | Introduces helper(s) for validating output formats and producing actionable format errors. |
| pkg/bgctl/cmd/output_format_error_test.go | Adds unit tests for the new output-format validation/error helper. |
| pkg/bgctl/cmd/config.go | Adds actionable guidance when deleting a non-existent context. |
| pkg/bgctl/cmd/config_commands_test.go | Extends test coverage to assert the new missing-context guidance. |
| CHANGELOG.md | Documents the CLI usability improvements under Unreleased changes. |
You can also share your feedback on Copilot code review. Take the survey.
| func validateOutputFormat(format output.Format, supported ...output.Format) error { | ||
| for _, value := range supported { | ||
| if format == value { | ||
| return nil | ||
| } | ||
| } | ||
| return unknownOutputFormatError(format, supported...) | ||
| } | ||
|
|
||
| func writeRuntimeObject(rt *runtimeState, obj any, supported ...output.Format) error { | ||
| format := output.Format(rt.OutputFormat()) | ||
| if err := validateOutputFormat(format, supported...); err != nil { | ||
| return err | ||
| } | ||
| return output.WriteObject(rt.Writer(), format, obj) | ||
| } | ||
|
|
||
| func unknownOutputFormatError(format output.Format, supported ...output.Format) error { | ||
| if len(supported) == 0 { | ||
| return fmt.Errorf("unknown output format: %s", format) | ||
| } | ||
|
|
||
| choices := make([]string, 0, len(supported)) | ||
| for _, value := range supported { | ||
| choices = append(choices, string(value)) | ||
| } | ||
|
|
||
| return fmt.Errorf("unknown output format: %s (choose from: %s)", format, strings.Join(choices, ", ")) |
📸 UI ScreenshotsCaptured 22 screenshots (11 light, 11 dark mode) 📥 Download
Pages Captured
Screenshots are generated automatically on each PR that modifies frontend code. |
Summary
bgctl session,bgctl debug, andbgctl escalationcommands to include supported format choices2s,1m)--stateflag help text to mention comma-separated filter valuesbgctl config delete-context(bgctl config get-contexts)Scope
This is a focused first slice of #544 (error/help text and guidance improvements). Remaining items (broader command examples, additional short flags, and update progress UX) can be handled in follow-up PRs.
Refs #544
Validation