Repository navigation
Conversation
Author
|
The upstream workflow is waiting for approval to run. Could you approve it when reviewing this PR? The fork validation passed the full race suite, vet, and build on Linux with Go 1.25, 1.26, and 1.27, checking out the exact PR source commit |
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.
Strict subcommand parsing currently drops parent options from the list used to fill defaults and check required fields. For example, parsing
childwithStrictSubcommands: truesilently leaves a parentdefault:"8080"port at zero, and accepts a missing parentarg:"required"option. The same definitions work correctly without strict mode.Keep the options of every selected command for the final defaults and required-field pass. Continue using only the current command's options for strict flag lookup, so parent flags must still appear before the subcommand. This also handles nested commands and aliases without visiting unselected branches.
This is a follow-up to the strict ordering behavior introduced in #205. I did not find an existing issue or PR for the lost parent validation/defaults; the examples were reproduced against master
cba3ff8during code inspection.Validation on macOS arm64, Go 1.27.4:
IgnoreDefault, environment/CLI precedence, and same-name flags at different command levels.go test -race -coverprofile=profile.cov ./... -count=1: passed, 100% statement coverage.go vet ./...,go build ./..., gofmt andgit diff --check: passed.Linux CI also passed the full race suite,
go vet, andgo buildon Go 1.25.14, 1.26.11, and 1.27.4. The fork validation workflow checks out patch commit1cd23d8explicitly; the diagnostic workflow is kept on a separate branch.Developed and validated with OpenAI Codex.