Skip to content

Honor partial passthrough mode on commands - #661

Open
x0Lazarus wants to merge 1 commit into
alecthomas:masterfrom
x0Lazarus:fix/command-partial-passthrough
Open

x0Lazarus wants to merge 1 commit into
alecthomas:masterfrom
x0Lazarus:fix/command-partial-passthrough

Conversation

@x0Lazarus

Copy link
Copy Markdown

Closes #659.

A command tagged passthrough:"partial" currently stops flag parsing as soon as the command is selected, so command --flag value program forwards --flag value instead of parsing the inherited flag. Apply partial passthrough to the command's single positional argument so inherited flags are parsed until the first positional; arguments after that point are forwarded unchanged. Empty/default and explicit all modes retain their existing behavior.

The regression cases cover inherited long/short/equals flags, flags on either side of the positional boundary, unknown flags, --, a bare dash, empty input, and aliases. The README describes the command modes explicitly.

Validation on Windows:

  • Full go test -count=1 ./... passes with Go 1.24.13 and Go 1.27.1.
  • Repository-pinned golangci-lint 1.64.5 passes with the existing configuration using Go 1.24.13 and the Hermit-pinned Go 1.26.5.
  • go vet -structtag=false ./... passes. Plain go vet ./... reports the same existing shorthand struct-tag diagnostics on the unchanged base and this patch; the project's lint configuration already excludes those diagnostics.

The complete hosted Linux/Windows matrix has not run locally.

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.

passthrough:"<mode>"` is silently ignored on a cmd:"" tag

1 participant