Skip to content

Commit 1a71175

Browse files
committed
Use strings.Trim
1 parent 89b150f commit 1a71175

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

docs.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,11 @@ func (tabularTemplate) Prettify(s string) string {
567567
// cli.BoolFlag will always return an default.
568568
func getFlagDefaultValue(f cli.DocGenerationFlag) (value, text string) {
569569
if defaultText := f.GetDefaultText(); defaultText != "" {
570-
return "", strings.Trim(defaultText, "\"")
570+
if _, ok := f.(*cli.StringFlag); ok {
571+
return "", strings.Trim(defaultText, "\"")
572+
} else {
573+
return "", defaultText
574+
}
571575
}
572576

573577
if !f.TakesValue() {
@@ -578,7 +582,11 @@ func getFlagDefaultValue(f cli.DocGenerationFlag) (value, text string) {
578582
}
579583

580584
if value := f.GetValue(); value != "" {
581-
return strings.Trim(value, "\""), ""
585+
if _, ok := f.(*cli.StringFlag); ok {
586+
return strings.Trim(value, "\""), ""
587+
} else {
588+
return value, ""
589+
}
582590
}
583591
return "", ""
584592
}

0 commit comments

Comments
 (0)