aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
authorFilipe Brandenburger <[email protected]>2015-01-22 14:03:39 -0800
committerFilipe Brandenburger <[email protected]>2015-01-22 14:03:39 -0800
commitf82776d6cc998e3c026baef7b24409ff49fe5c8d (patch)
tree4d43314fadda7f1514d21f742b697ecb33085410 /flag.go
parent463bdc838f2b35e9307e91d480878bda5fff7232 (diff)
parent376ea2fc4b79bc6fbca80f585898271e7890d6b5 (diff)
Merge pull request #3 from filbranden/bool_value_for_spf13
Bool value for spf13
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/flag.go b/flag.go
index 47761a0..2e4cac0 100644
--- a/flag.go
+++ b/flag.go
@@ -466,7 +466,7 @@ func (f *FlagSet) parseLongArg(s string, args []string) (a []string, err error)
return
}
if len(split) == 1 {
- if _, ok := flag.Value.(*boolValue); !ok {
+ if bv, ok := flag.Value.(boolFlag); !ok || !bv.IsBoolFlag() {
err = f.failf("flag needs an argument: %s", s)
return
}
@@ -500,7 +500,7 @@ func (f *FlagSet) parseShortArg(s string, args []string) (a []string, err error)
}
}
if alreadythere {
- if _, ok := flag.Value.(*boolValue); ok {
+ if bv, ok := flag.Value.(boolFlag); ok && bv.IsBoolFlag() {
f.setFlag(flag, "true", s)
continue
}