Repository navigation
Silence Cobra's usage dump on command errors - #128
Merged
Merged
Conversation
added 3 commits
August 19, 2026 17:28
TestRootSilencesUsageOnError reproduces crn-rott9's reported symptom: a RunE/PersistentPreRunE error currently surfaces buried under Cobra's default usage/help dump, pushing the real error line off the top of a tail-8'd terminal.
Cobra's ExecuteC checks SilenceUsage on both the root and the leaf command found via Find(); setting it on rootCmd silences the usage dump for every subcommand's error, matching the existing per-command opt-in already used in format.go/remember_batch.go but applied globally.
7/7 PASS. Self-merge authorized under the reinstated standing authorization (mayor ruling gm-wisp-2yhv7u).
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.
Errors from any subcommand were getting buried under Cobra's default usage/help block, pushing the actual error message off the top of a truncated terminal view.
Sets
SilenceUsage: trueon the root command so the usage dump no longer prints on error, matching the behavior a couple of individual commands already opted into locally — now applied globally. Includes a regression test covering the original symptom.