From be0cc4b8715d2a57f03b395ae928db61048bb679 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Tue, 1 Oct 2019 20:18:53 -0700 Subject: [PATCH] add a check --- command.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/command.go b/command.go index 70502e8..d41a1bf 100644 --- a/command.go +++ b/command.go @@ -261,6 +261,10 @@ func argIsFlag(commandFlags []Flag, arg string) bool { if arg == "-" { return false } + // flags always start with a - + if !strings.HasPrefix(arg, "-") { + return false + } // this line turns `--flag` into `flag` if strings.HasPrefix(arg, "--") { arg = strings.Replace(arg, "-", "", 2)