Skip to content

Show ancestor arguments in subcommand usage - #302

Open
rupayon123 wants to merge 1 commit into
alexflint:masterfrom
rupayon123:contribution/ancestor-usage-20260923
Open

rupayon123 wants to merge 1 commit into
alexflint:masterfrom
rupayon123:contribution/ancestor-usage-20260923

Conversation

@rupayon123

@rupayon123 rupayon123 commented Sep 23, 2026 •

Copy link
Copy Markdown

Fixes #296.

A nested subcommand's synopsis omitted options accepted by its parent commands. For example, the usage line showed example child nested [--baz BAZ] even though --foo belongs before child and --bar before nested. The usage writer now emits each command's arguments before the next subcommand name, yielding example [--foo FOO] child [--bar BAR] nested [--baz BAZ].

The new regression test reproduced the omission before the change and verifies that the displayed option sequence actually parses. Existing help and example expectations were updated for this intended output change. This branch is based on upstream master and is separate from #301. It touches usage.go, so #300 may create a later integration conflict.

Validation on macOS/Go 1.27.1: go test ./... -count=1, go test -race ./... -count=1, go vet ./..., gofmt, and git diff --check pass. Remote CI has not yet run.

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.

Usage text for subcommands doesn't display arguments for parents

1 participant