Skip to content

Set SilenceUsage: true on every leaf command - #194

Merged
nathanjcochran merged 2 commits into
mainfrom
nathan/silence-usage
Aug 24, 2026
Merged

Set SilenceUsage: true on every leaf command#194
nathanjcochran merged 2 commits into
mainfrom
nathan/silence-usage

Conversation

@nathanjcochran

@nathanjcochran nathanjcochran commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Every command with a RunE now sets SilenceUsage: true as a literal field on its cobra.Command, instead of setting cmd.SilenceUsage = true inline after argument validation.
  • A bad flag or invalid argument now prints just the error, instead of the error followed by the full help/usage text — the error used to get buried at the top of a long usage dump (most of which is not actually relevant to the user's command), making it hard to spot.
  • Updated the "Cobra Usage Display Pattern" section in CLAUDE.md to describe the new, simpler rule.

@nathanjcochran nathanjcochran self-assigned this Aug 19, 2026
@nathanjcochran
nathanjcochran merged commit f424865 into main Aug 24, 2026
2 checks passed
@nathanjcochran
nathanjcochran deleted the nathan/silence-usage branch August 24, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants