Merge branch 'v2' into migrators
This commit is contained in:
commit
1d13fa8140
4
flag.go
4
flag.go
@ -670,8 +670,8 @@ func stringifyFlag(f Flag) string {
|
|||||||
defaultValueString := ""
|
defaultValueString := ""
|
||||||
val := fv.FieldByName("Value")
|
val := fv.FieldByName("Value")
|
||||||
|
|
||||||
if val.IsValid() && val.Kind() != reflect.Bool {
|
if val.IsValid() {
|
||||||
needsPlaceholder = true
|
needsPlaceholder = val.Kind() != reflect.Bool
|
||||||
defaultValueString = fmt.Sprintf(" (default: %v)", val.Interface())
|
defaultValueString = fmt.Sprintf(" (default: %v)", val.Interface())
|
||||||
|
|
||||||
if val.Kind() == reflect.String && val.String() != "" {
|
if val.Kind() == reflect.String && val.String() != "" {
|
||||||
|
@ -15,8 +15,8 @@ var boolFlagTests = []struct {
|
|||||||
name string
|
name string
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{"help", "--help\t"},
|
{"help", "--help\t(default: false)"},
|
||||||
{"h", "-h\t"},
|
{"h", "-h\t(default: false)"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBoolFlagHelpOutput(t *testing.T) {
|
func TestBoolFlagHelpOutput(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user