diff --git a/docs.go b/docs.go index 6327dea14d..98e9adec1b 100644 --- a/docs.go +++ b/docs.go @@ -54,8 +54,6 @@ func (a *App) writeDocTemplate(w io.Writer) error { }) } -const nl = "\n" - func prepareCommands(commands []Command, level int) []string { coms := []string{} for i := range commands { @@ -73,9 +71,8 @@ func prepareCommands(commands []Command, level int) []string { flags := prepareArgsWithValues(command.Flags) if len(flags) > 0 { - prepared += nl + prepared += fmt.Sprintf("\n%s", strings.Join(flags, "\n")) } - prepared += strings.Join(flags, nl) coms = append(coms, prepared) @@ -113,21 +110,21 @@ func prepareFlags( modifiedArg += sep } if len(trimmed) > 1 { - modifiedArg += "--" + trimmed + modifiedArg += fmt.Sprintf("--%s", trimmed) } else { - modifiedArg += "-" + trimmed + modifiedArg += fmt.Sprintf("-%s", trimmed) } } modifiedArg += closer if flag.TakesValue() { - modifiedArg += "=" + value + modifiedArg += fmt.Sprintf("=%s", value) } if addDetails { modifiedArg += flagDetails(flag) } - args = append(args, modifiedArg+nl) + args = append(args, modifiedArg+"\n") } sort.Strings(args)