Scope subcommand usage help#22326
Merged
Merged
Conversation
8139245 to
9b86578
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR scopes help, manpage, and shell completion output for commands with subcommands so root help shows root options/subcommand summaries while matched subcommands show their own valid flags.
Changes:
- Adds subcommand-aware option metadata and help generation in the CLI parser.
- Updates completions/manpage generation to use root vs subcommand-specific options.
- Refines
bundleandservicesoption descriptions and adds regression tests.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Library/Homebrew/cli/parser.rb |
Adds root/subcommand option summary tracking and scoped help rendering. |
Library/Homebrew/help.rb |
Passes usage-error context into parser help generation. |
Library/Homebrew/commands.rb |
Returns root-only options when no subcommand is requested. |
Library/Homebrew/completions.rb |
Generates top-level completions from root options only. |
Library/Homebrew/manpages.rb |
Emits root options and subcommand options separately. |
Library/Homebrew/bundle/subcommand/* |
Updates bundle option descriptions to be subcommand-specific. |
Library/Homebrew/bundle/extensions/* |
Removes shared extension switch description helper. |
Library/Homebrew/services/subcommand/* |
Updates services --all descriptions per operation. |
Library/Homebrew/test/* |
Adds/updates parser, manpage, completion, bundle, and services coverage. |
completions/bash/brew |
Regenerates bash completion output. |
completions/fish/brew.fish |
Regenerates fish completion output. |
completions/zsh/_brew |
Regenerates zsh completion output. |
docs/Manpage.md |
Regenerates Markdown manpage documentation. |
manpages/brew.1 |
Regenerates roff manpage documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9b86578 to
b0575be
Compare
- Avoid overwhelming `UsageError` output for commands with subcommands. - Keep root command help to subcommand summaries and root flags. - Reuse parser metadata so matched subcommands show valid flags only. - Group generated manpage options with their matching subcommands. - Scope generated shell completions to root and subcommand flags. - Use operation-specific flag text in help, manpages and completions.
b0575be to
7b199a7
Compare
SMillerDev
approved these changes
May 18, 2026
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.
UsageErroroutput for commands with subcommands.brew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex 5.5 xhigh with local review and testing.