mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
suport --falg=value
This commit is contained in:
parent
aa5b1bc599
commit
8b3a405da9
1 changed files with 3 additions and 0 deletions
|
@ -584,6 +584,9 @@ Loop:
|
||||||
case s == "--":
|
case s == "--":
|
||||||
// "--" terminates the flags
|
// "--" terminates the flags
|
||||||
break Loop
|
break Loop
|
||||||
|
case strings.HasPrefix(s, "--") && strings.Contains(s, "="):
|
||||||
|
// If --flag=value
|
||||||
|
fallthrough
|
||||||
case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && hasNoOptDefVal(s[2:], flags):
|
case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && hasNoOptDefVal(s[2:], flags):
|
||||||
// If '--flag'
|
// If '--flag'
|
||||||
beforeArgs = append(beforeArgs, s)
|
beforeArgs = append(beforeArgs, s)
|
||||||
|
|
Loading…
Add table
Reference in a new issue