mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Terminate the stripping of flags when -- is found (#649)
This commit is contained in:
parent
c6c44e6fdc
commit
c439c4fa09
1 changed files with 3 additions and 0 deletions
|
@ -475,6 +475,9 @@ Loop:
|
||||||
s := args[0]
|
s := args[0]
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
switch {
|
switch {
|
||||||
|
case s == "--":
|
||||||
|
// "--" terminates the flags
|
||||||
|
break Loop
|
||||||
case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
|
case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
|
||||||
// If '--flag arg' then
|
// If '--flag arg' then
|
||||||
// delete arg from args.
|
// delete arg from args.
|
||||||
|
|
Loading…
Reference in a new issue