do not display suggestions if command fails#122
Merged
gtrrz-victor merged 2 commits intomainfrom Jan 29, 2026
Merged
Conversation
Entire-Checkpoint: 7ed4051c8a85
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves the CLI's error handling by only displaying usage suggestions when command failures are due to bad CLI usage (unknown commands or invalid flags), rather than showing them for all errors. This reduces noise for operational failures.
Changes:
- Added selective error handling in main.go to distinguish between CLI usage errors (unknown commands) and operational errors
- Set
SilenceUsage: truein root command to prevent automatic usage display - Added custom flag error handler that displays usage and wraps errors with
SilentError
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cmd/entire/main.go | Added error type detection to show suggestions only for unknown commands, implemented showSuggestion function for custom error messages with command suggestions |
| cmd/entire/cli/root.go | Enabled SilenceUsage and added SetFlagErrorFunc to handle flag errors with custom formatting |
khaong
approved these changes
Jan 29, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only display suggestions when the command fails due to bad CLI usage (wrong command, wrong flags, etc.). That's where they're useful. For other failures, it's just noise.
Current:
How it looks now:
Note
Low Risk
Low risk CLI UX change that adjusts when usage output is printed; main concern is the string-based detection of "unknown" errors potentially missing/overmatching in future Cobra error messages.
Overview
Reduces noisy CLI output by silencing Cobra usage by default (
SilenceUsage: true) and moving usage/error printing intomain.go.main.gonow only prints the full usage + "Invalid usage" error message for bad CLI usage cases (unknown command/unknown flag); other runtime errors are printed plainly, andSilentErrorcontinues to suppress duplicate output.Written by Cursor Bugbot for commit 41aa312. This will update automatically on new commits. Configure here.