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 spf13#1816
  • Loading branch information
oncilla committed Jan 2, 2023
1 parent bf11ab6 commit f3bcbcf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion command.go
Expand Up @@ -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] != '-'))
}

Expand Down

0 comments on commit f3bcbcf

Please sign in to comment.