Skip to content

Commit 8cff8e6

Browse files
committed
BoolFlag code should be next to other
1 parent 71fedf3 commit 8cff8e6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ func (tt tabularTemplate) PrepareFlags(flags []cli.Flag) []cliTabularFlagTemplat
411411
} else if value != "" {
412412
defaultValue = fmt.Sprintf("`%s`", value)
413413
}
414+
if boolFlag, isBool := appFlag.(*cli.BoolFlag); isBool && defaultText == "" {
415+
defaultValue = fmt.Sprintf("`%s`", strconv.FormatBool(boolFlag.Value))
416+
}
414417

415418
f := cliTabularFlagTemplate{
416419
Usage: tt.PrepareMultilineString(flag.GetUsage()),
@@ -420,10 +423,6 @@ func (tt tabularTemplate) PrepareFlags(flags []cli.Flag) []cliTabularFlagTemplat
420423
Type: flag.TypeName(),
421424
}
422425

423-
if boolFlag, isBool := appFlag.(*cli.BoolFlag); isBool && defaultText == "" {
424-
f.Default = fmt.Sprintf("`%s`", strconv.FormatBool(boolFlag.Value))
425-
}
426-
427426
for i, name := range appFlag.Names() {
428427
name = strings.TrimSpace(name)
429428

0 commit comments

Comments
 (0)