mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Add comments
Signed-off-by: JaySon-Huang <tshent@qq.com>
This commit is contained in:
parent
d364ed0157
commit
cb29346a0f
1 changed files with 4 additions and 1 deletions
|
@ -588,7 +588,10 @@ Loop:
|
|||
if len(args) == 0 {
|
||||
break Loop
|
||||
}
|
||||
// Only delete 'arg' when it is not starts with '-'
|
||||
// When the flag 's' doesn't contain "=" and without "no option default values", but
|
||||
// following with a string starts with '-', consider 's' an unknown boolean flag
|
||||
// and don't delete 'arg'.
|
||||
// Otherwise, consider it as '--flag arg' or '-f arg' and delete its following arg.
|
||||
if !strings.HasPrefix(args[0], "-") {
|
||||
args = args[1:]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue