Skip to content

Commit 89b150f

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

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

docs.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,7 @@ 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-
if strings.HasPrefix(defaultText, "\"") && strings.HasSuffix(defaultText, "\"") {
571-
defaultText = defaultText[1 : len(defaultText)-1]
572-
}
573-
return "", defaultText
570+
return "", strings.Trim(defaultText, "\"")
574571
}
575572

576573
if !f.TakesValue() {
@@ -581,10 +578,7 @@ func getFlagDefaultValue(f cli.DocGenerationFlag) (value, text string) {
581578
}
582579

583580
if value := f.GetValue(); value != "" {
584-
if strings.HasPrefix(value, "\"") && strings.HasSuffix(value, "\"") {
585-
value = value[1 : len(value)-1]
586-
}
587-
return value, ""
581+
return strings.Trim(value, "\""), ""
588582
}
589583
return "", ""
590584
}

0 commit comments

Comments
 (0)