Browse Source

Merge pull request #4426 from vieux/prevent_grouping_--

prevent flag grouping with --
unclejack 11 years ago
parent
commit
93f925c533
1 changed files with 3 additions and 0 deletions
  1. 3 0
      pkg/mflag/flag.go

+ 3 - 0
pkg/mflag/flag.go

@@ -772,6 +772,9 @@ func (f *FlagSet) parseOne() (bool, string, error) {
 			f.usage()
 			return false, "", ErrHelp
 		}
+		if len(name) > 0 && name[0] == '-' {
+			return false, "", f.failf("flag provided but not defined: -%s", name)
+		}
 		return false, name, ErrRetry
 	}
 	if fv, ok := flag.Value.(boolFlag); ok && fv.IsBoolFlag() { // special case: doesn't need an arg