From 10546a043ba2d7ed1b386033fbd8336abec9b2e6 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Sat, 21 Nov 2015 06:23:56 -0700 Subject: [PATCH] Remove extraneous comma at the end of SEE ALSO list --- man_docs.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/man_docs.go b/man_docs.go index 3e852f7..c168b62 100644 --- a/man_docs.go +++ b/man_docs.go @@ -200,7 +200,7 @@ func genMarkdown(cmd *Command, header *GenManHeader) []byte { if cmd.HasParent() { parentPath := cmd.Parent().CommandPath() dashParentPath := strings.Replace(parentPath, " ", "-", -1) - fmt.Fprintf(buf, "**%s(%s)**, ", dashParentPath, header.Section) + fmt.Fprintf(buf, "**%s(%s)**", dashParentPath, header.Section) cmd.VisitParents(func(c *Command) { if c.DisableAutoGenTag { cmd.DisableAutoGenTag = c.DisableAutoGenTag @@ -209,11 +209,14 @@ func genMarkdown(cmd *Command, header *GenManHeader) []byte { } children := cmd.Commands() sort.Sort(byName(children)) - for _, c := range children { + for i, c := range children { if !c.IsAvailableCommand() || c == cmd.helpCommand { continue } - fmt.Fprintf(buf, "**%s-%s(%s)**, ", dashCommandName, c.Name(), header.Section) + if cmd.HasParent() || i > 0 { + fmt.Fprintf(buf, ", ") + } + fmt.Fprintf(buf, "**%s-%s(%s)**", dashCommandName, c.Name(), header.Section) } fmt.Fprintf(buf, "\n") }