From f3bcbcfc99b25e42d30f8beef849d1b093af6dcf Mon Sep 17 00:00:00 2001 From: Dominik Roos Date: Wed, 28 Sep 2022 10:20:46 +0200 Subject: [PATCH] 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 --- command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command.go b/command.go index f032dbc42..b6e3f4a1c 100644 --- a/command.go +++ b/command.go @@ -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] != '-')) }