diff options
| author | Eric Paris <[email protected]> | 2015-05-08 13:08:03 -0500 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-05-08 13:08:03 -0500 |
| commit | f1e68ce945b0710375b5cccee37318a3d13fdf8c (patch) | |
| tree | 8d9b6f6c27f467f9df4f18e9bc9ebd608f7351cf /flag.go | |
| parent | 0d4b3d7112e1cd81953793e92031e43dc5a52190 (diff) | |
| parent | 7bb45fd9d55ef17a0a0bdc8fcb7482e180a401b9 (diff) | |
Merge pull request #21 from eparis/bool-equal-fix
Support bool= with shortnames
Diffstat (limited to 'flag.go')
| -rw-r--r-- | flag.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -553,10 +553,13 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string) (outShor return } var value string - if bv, ok := flag.Value.(boolFlag); ok && bv.IsBoolFlag() { + if len(shorthands) > 2 && shorthands[1] == '=' { + value = shorthands[2:] + outShorts = "" + } else if bv, ok := flag.Value.(boolFlag); ok && bv.IsBoolFlag() { value = "true" } else if len(shorthands) > 1 { - value = strings.TrimPrefix(shorthands[1:], "=") + value = shorthands[1:] outShorts = "" } else if len(args) > 0 { value = args[0] |
