Skip to content

Keep arguments after a bare dash - #2419

Open
official-burak wants to merge 1 commit into
urfave:mainfrom
official-burak:fix-bare-dash-keeps-following-args
Open

Keep arguments after a bare dash#2419
official-burak wants to merge 1 commit into
urfave:mainfrom
official-burak:fix-bare-dash-keeps-following-args

Conversation

@official-burak

@official-burak official-burak commented Aug 26, 2026

Copy link
Copy Markdown

What type of PR is this?

  • bug

What this PR does / why we need it:

parseFlags treated a lone - as a positional, then break out of the rearrangement loop. Everything after - was dropped with no error.

Neighboring paths use continue (empty arg, other positionals) or keep the remainder (--). This matches Go's flag package: - is an operand, parsing continues.

Which issue(s) this PR fixes:

Fixes #2418

Testing

TestCommand_BareDashKeepsFollowingArgs failed with Args() == ["-"] before the change and passes after. Full go test -count=1 passes.

Release Notes

Keep arguments that follow a bare `-` instead of silently discarding them.

@official-burak
official-burak requested a review from a team as a code owner August 26, 2026 13:56
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.

A bare "-" argument silently discards all following arguments in parseFlags

1 participant