-
-
Notifications
You must be signed in to change notification settings - Fork 154
Closed
Description
We are observing a behavior change with the new version v1.5.0. I am unsure whether it is intentional, hence creating this issue.
Given a CLI definition like following
var cli struct {
Color *outputcolor.Level `short:"c"`
Leftovers []string `arg:"" optional:""`
}and arguments as -cfoo we see the following error value in v1.4.0:
err = {error | *kong.ParseError}
error = {error | *kong.unknownFlagError} unknown flag -f, did you mean one of "-h", "-c"?
Context = {*kong.Context | 0x140000e6680}
but there is no error reported with the v1.5.0.
I reproduced the issue at oguzhand95/kong-reprod.
The main branch is v1.4.0 and the PR updates the kong to v1.5.0 with failing tests.
Lines 436 to 444 in 96647c3
| case ShortFlagToken: | |
| if err := c.parseFlag(flags, token.String()); err != nil { | |
| if isUnknownFlagError(err) && positional < len(node.Positional) && node.Positional[positional].PassthroughMode == PassThroughModeAll { | |
| c.scan.Pop() | |
| c.scan.PushTyped(token.String(), PositionalArgumentToken) | |
| } else { | |
| return err | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels