Skip to content

Commit

Permalink
completions: do not detect arguments with dash as 2nd char as flag
Browse files Browse the repository at this point in the history
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
  • Loading branch information
oncilla committed Sep 28, 2022
1 parent fce8d8a commit cf24c44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion command.go
Expand Up @@ -627,7 +627,7 @@ func argsMinusFirstX(args []string, x string) []string {
}

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] != '-'))
}

Expand Down

0 comments on commit cf24c44

Please sign in to comment.