aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
authorEric Paris <[email protected]>2015-05-27 16:10:28 -0400
committerEric Paris <[email protected]>2015-06-22 15:29:55 -0400
commit469982769211123a1718ad9edf5d03bd39aed547 (patch)
treee27225869f2771ded175b16e1ce51e8f9cdcbdf6 /flag.go
parentb319e90e90fa3261384806182c8f147a4d16c46a (diff)
Add support for '--flag arg'
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/flag.go b/flag.go
index 55c381c..865259b 100644
--- a/flag.go
+++ b/flag.go
@@ -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)