Conversation
|
Member
|
Good change, very easy to understand! And also the type of thing someone might have a scripted reliance on. So I'll have to think about that. |
coilysiren
reviewed
Oct 6, 2026
|
|
||
| // Once the boundary is reached, preserve all remaining tokens, | ||
| // including empty arguments and the double-dash separator. | ||
| if cmd.StopOnNthArg != nil && len(posArgs) == *cmd.StopOnNthArg { |
Member
There was a problem hiding this comment.
Just echo-ing my top level comment -
Good change, very easy to understand!
And also the type of thing someone might have a scripted reliance on. So I'll have to think about that.
This branch has not been deployed
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.
What type of PR is this?
What this PR does / why we need it:
StopOnNthArgchecks its positional-argument boundary after the empty-token and--branches. With a limit of one,exec host "" --verbose tailskips past the boundary and still setsverbose;exec host -- --verbose tailremoves the separator before passing the arguments to the action.Move the existing boundary check before token classification so all remaining arguments reach the action unchanged once the limit is reached.
command_parse.go: check the existing passthrough boundary before handling empty tokens or separators.command_stop_boundary_test.go: cover root/subcommand boundaries, parsing controls, persistent flags and action lifecycle, and actual subprocess argv containing an empty argument or--.Which issue(s) this PR fixes:
No existing issue found for this boundary case. It corrects the passthrough behavior introduced in #2163.
Special notes for your reviewer:
The change preserves normal flag parsing and separator handling before the configured boundary. Public API, dependencies, and generated API documentation are unchanged.
Testing
Original-source regression: 17 failing scenarios and four passing controls; the same final tests pass all 21 scenarios with the correction. The process cases execute the compiled test binary with real argv.
go test -race ./..., with and withouturfave_cli_no_template,make vet,make check-binary-size, andmake diffcheckpass. The full suites retain their existing six/twelve skipped tests; the added regression has no skips.make all,make test GFLAGS='--tags urfave_cli_no_template', goimports, golangci-lint 2.14.0 and formatter,make v3diff, andmake diffcheckpass on both the original baseline and the correction. The generated API files are unchanged.make allgfmrun target currently checks a README containing no executable examples.These fork runs check out source commit
9c76dcd12ecdc7d5542d7e522032a08fc6713674and preserve the source hashes and clean tracked-file state before and after verification.Release Notes