Preserve double dash values during flag alias parsing

This commit is contained in:
2026-10-20 00:28:38 +00:00
parent 744b8135f2
commit eb92f7be7f
3 changed files with 33 additions and 3 deletions

View File

@@ -215,7 +215,7 @@ passed on Go 1.26.8.
## R-6: Keep the flag interpretation pass consistent with value consumption
Status: open. Priority: P2. Category: canonical/alias parsing divergence.
Status: complete. Priority: P2. Category: canonical/alias parsing divergence.
**Evidence:** [interpretFlagTokens](../../internal/cobra/flags.go#L28) refuses to
consume a following `--` as the value of a value-taking flag in both the long
@@ -242,6 +242,13 @@ introducing a different operand/option convention.
values. Cover canonical and aliased long/short spellings, and preserve ordinary
termination when `--` occurs after a completed value or boolean flag.
**Completed:** The alias interpretation pass now consumes the next token for
value-taking long and short flags even when that value is `--`, matching backend
arity. All four canonical/alias long/short regressions failed before the fix and
now retain the value, later alias occurrences, original spellings, and genuine
post-value terminators. Boolean/value termination cases also pass. No accepted
value was prohibited. The complete offline root suite passed on Go 1.26.8.
## R-7: Retain entered flag spellings in parser-level usage failures
Status: open. Priority: P3. Category: incomplete diagnostic adaptation.