From fac67ac91ab4928f484fa425a4f66ff0537333c2 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sat, 21 May 2016 20:02:08 -0400 Subject: [PATCH] Show BoolFlag default value in help usage now that BoolTFlag is gone --- flag.go | 4 ++-- flag_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flag.go b/flag.go index 97e502c..b5241e0 100644 --- a/flag.go +++ b/flag.go @@ -624,8 +624,8 @@ func stringifyFlag(f Flag) string { defaultValueString := "" val := fv.FieldByName("Value") - if val.IsValid() && val.Kind() != reflect.Bool { - needsPlaceholder = true + if val.IsValid() { + needsPlaceholder = val.Kind() != reflect.Bool defaultValueString = fmt.Sprintf(" (default: %v)", val.Interface()) if val.Kind() == reflect.String && val.String() != "" { diff --git a/flag_test.go b/flag_test.go index a3414cf..ce786b7 100644 --- a/flag_test.go +++ b/flag_test.go @@ -14,8 +14,8 @@ var boolFlagTests = []struct { name string expected string }{ - {"help", "--help\t"}, - {"h", "-h\t"}, + {"help", "--help\t(default: false)"}, + {"h", "-h\t(default: false)"}, } func TestBoolFlagHelpOutput(t *testing.T) {