@@ -27,6 +27,8 @@ import (
2727 "github.com/spf13/cobra"
2828)
2929
30+ const markdownExtension = ".md"
31+
3032func printOptions (buf * bytes.Buffer , cmd * cobra.Command , name string ) error {
3133 flags := cmd .NonInheritedFlags ()
3234 flags .SetOutput (buf )
@@ -83,7 +85,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
8385 if cmd .HasParent () {
8486 parent := cmd .Parent ()
8587 pname := parent .CommandPath ()
86- link := pname + ".md"
88+ link := pname + markdownExtension
8789 link = strings .ReplaceAll (link , " " , "_" )
8890 buf .WriteString (fmt .Sprintf ("* [%s](%s)\t - %s\n " , pname , linkHandler (link ), parent .Short ))
8991 cmd .VisitParents (func (c * cobra.Command ) {
@@ -101,7 +103,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
101103 continue
102104 }
103105 cname := name + " " + child .Name ()
104- link := cname + ".md"
106+ link := cname + markdownExtension
105107 link = strings .ReplaceAll (link , " " , "_" )
106108 buf .WriteString (fmt .Sprintf ("* [%s](%s)\t - %s\n " , cname , linkHandler (link ), child .Short ))
107109 }
@@ -138,7 +140,7 @@ func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHa
138140 }
139141 }
140142
141- basename := strings .ReplaceAll (cmd .CommandPath (), " " , "_" ) + ".md"
143+ basename := strings .ReplaceAll (cmd .CommandPath (), " " , "_" ) + markdownExtension
142144 filename := filepath .Join (dir , basename )
143145 f , err := os .Create (filename )
144146 if err != nil {
0 commit comments