diff options
| author | Eric Paris <[email protected]> | 2015-05-27 16:10:28 -0400 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-06-22 15:29:55 -0400 |
| commit | 469982769211123a1718ad9edf5d03bd39aed547 (patch) | |
| tree | e27225869f2771ded175b16e1ce51e8f9cdcbdf6 /flag.go | |
| parent | b319e90e90fa3261384806182c8f147a4d16c46a (diff) | |
Add support for '--flag arg'
Diffstat (limited to 'flag.go')
| -rw-r--r-- | flag.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -585,6 +585,10 @@ func (f *FlagSet) parseLongArg(s string, args []string) (a []string, err error) } else if len(flag.NoOptDefVal) > 0 { // '--flag' (arg was optional) value = flag.NoOptDefVal + } else if len(a) > 0 { + // '--flag arg' + value = a[0] + a = a[1:] } else { // '--flag' (arg was required) err = f.failf("flag needs an argument: %s", s) |
