From 3bd84ba55cd9056ba8380a99a88ae0cafca05cc8 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Sat, 21 Nov 2015 06:13:53 -0700 Subject: [PATCH] Ensure man page title is uppercase and has rootcmd As described in http://man7.org/linux/man-pages/man7/man-pages.7.html --- man_docs.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/man_docs.go b/man_docs.go index 4107808..36bbf26 100644 --- a/man_docs.go +++ b/man_docs.go @@ -95,7 +95,7 @@ func (cmd *Command) GenMan(header *GenManHeader, out *bytes.Buffer) { func fillHeader(header *GenManHeader, name string) { if header.Title == "" { - header.Title = name + header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1)) } if header.Section == "" { header.Section = "1" @@ -168,12 +168,13 @@ func manPrintOptions(out *bytes.Buffer, command *Command) { } func genMarkdown(cmd *Command, header *GenManHeader) []byte { - fillHeader(header, cmd.Name()) // something like `rootcmd subcmd1 subcmd2` commandName := cmd.CommandPath() // something like `rootcmd-subcmd1-subcmd2` dashCommandName := strings.Replace(commandName, " ", "-", -1) + fillHeader(header, commandName) + buf := new(bytes.Buffer) short := cmd.Short