Always return when err is not nil.
diff --git a/bool_test.go b/bool_test.go index 72a12be..fe45b8d 100644 --- a/bool_test.go +++ b/bool_test.go
@@ -9,7 +9,7 @@ "strconv" "testing" - . "github.com/ogier/pflag" + . "github.com/spf13/pflag" ) // This value can be a boolean ("true", "false") or "maybe"
diff --git a/example_test.go b/example_test.go index 6aaed3c..9be7a49 100644 --- a/example_test.go +++ b/example_test.go
@@ -11,7 +11,7 @@ "strings" "time" - flag "github.com/ogier/pflag" + flag "github.com/spf13/pflag" ) // Example 1: A single string flag called "species" with default value "gopher".
diff --git a/flag.go b/flag.go index ad65dda..72165f6 100644 --- a/flag.go +++ b/flag.go
@@ -498,6 +498,7 @@ if len(args) == 0 { return } + return } if alreadythere { if bv, ok := flag.Value.(boolFlag); ok && bv.IsBoolFlag() { @@ -551,6 +552,9 @@ } else { args, err = f.parseShortArg(s, args) } + if err != nil { + return + } } return }