mirror of
https://github.com/spf13/cobra
synced 2025-05-04 20:37:24 +00:00
completions: do not detect arguments with dash as 2nd char as flag
Previously, arguments with a dash as the second character (e.g., 1-ff00:0:1) were detected as a flag by mistake. This resulted in auto completion misbehaving if such an argument was last in the argument list during invocation. Fixes #1816
This commit is contained in:
parent
bf11ab6321
commit
f3bcbcfc99
1 changed files with 1 additions and 1 deletions
|
@ -692,7 +692,7 @@ Loop:
|
|||
}
|
||||
|
||||
func isFlagArg(arg string) bool {
|
||||
return ((len(arg) >= 3 && arg[1] == '-') ||
|
||||
return ((len(arg) >= 3 && arg[0:2] == "--") ||
|
||||
(len(arg) >= 2 && arg[0] == '-' && arg[1] != '-'))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue