Skip to content
Myr

Ensure man page title is uppercase and has rootcmd

Before adoption: this commit came in with the history the project adopted, so no landing records it.

As described in http://man7.org/linux/man-pages/man7/man-pages.7.html

authored by Anthony Fok · committed by Anthony Fok · parent baf44a3 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:man_docs.go+3 added-2 removed
93 unmodified lines
94}9596func fillHeader(header *GenManHeader, name string) {97 if header.Title == "" {98 header.Title = name98 header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1))99 }100 if header.Section == "" {101 header.Section = "1"102 }
64 unmodified lines
167 }168}169170func genMarkdown(cmd *Command, header *GenManHeader) []byte {171 fillHeader(header, cmd.Name())171 // something like `rootcmd subcmd1 subcmd2`172 commandName := cmd.CommandPath()173 // something like `rootcmd-subcmd1-subcmd2`174 dashCommandName := strings.Replace(commandName, " ", "-", -1)175176 fillHeader(header, commandName)177178 buf := new(bytes.Buffer)179180 short := cmd.Short181 long := cmd.Long
37 unmodified lines