Fixed mishandling of a "-"(dash)-argument causing reordering of cli non-flag arguments.
Added test demonstrating issue (PASS with fix, FAIL without).
This commit is contained in:
@@ -81,6 +81,9 @@ func (c Command) Run(ctx *Context) (err error) {
|
||||
if arg == "--" {
|
||||
terminatorIndex = index
|
||||
break
|
||||
} else if arg == "-" {
|
||||
// Do nothing. A dash alone is not really a flag.
|
||||
continue
|
||||
} else if strings.HasPrefix(arg, "-") && firstFlagIndex == -1 {
|
||||
firstFlagIndex = index
|
||||
}
|
||||
|
Reference in New Issue
Block a user