@@ -75,8 +75,7 @@ type GenManTreeOptions struct {
7575
7676// GenManHeader is a lot like the .TH header at the start of man pages. These
7777// include the title, section, date, source, and manual. We will use the
78- // current time if Date is unset and will use "Auto generated by spf13/cobra"
79- // if the Source is unset.
78+ // current time if Date is unset.
8079type GenManHeader struct {
8180 Title string
8281 Section string
@@ -92,7 +91,7 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
9291 if header == nil {
9392 header = & GenManHeader {}
9493 }
95- if err := fillHeader (header , cmd .CommandPath (), cmd . DisableAutoGenTag ); err != nil {
94+ if err := fillHeader (header , cmd .CommandPath ()); err != nil {
9695 return err
9796 }
9897
@@ -101,7 +100,7 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
101100 return err
102101}
103102
104- func fillHeader (header * GenManHeader , name string , disableAutoGen bool ) error {
103+ func fillHeader (header * GenManHeader , name string ) error {
105104 if header .Title == "" {
106105 header .Title = strings .ToUpper (strings .Replace (name , " " , "\\ -" , - 1 ))
107106 }
@@ -120,9 +119,6 @@ func fillHeader(header *GenManHeader, name string, disableAutoGen bool) error {
120119 header .Date = & now
121120 }
122121 header .date = (* header .Date ).Format ("Jan 2006" )
123- if header .Source == "" && ! disableAutoGen {
124- header .Source = "Auto generated by spf13/cobra"
125- }
126122 return nil
127123}
128124
@@ -208,11 +204,6 @@ func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
208204 dashParentPath := strings .Replace (parentPath , " " , "-" , - 1 )
209205 seealso := fmt .Sprintf ("**%s(%s)**" , dashParentPath , header .Section )
210206 seealsos = append (seealsos , seealso )
211- cmd .VisitParents (func (c * cobra.Command ) {
212- if c .DisableAutoGenTag {
213- cmd .DisableAutoGenTag = c .DisableAutoGenTag
214- }
215- })
216207 }
217208 children := cmd .Commands ()
218209 sort .Sort (byName (children ))
@@ -225,8 +216,5 @@ func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
225216 }
226217 buf .WriteString (strings .Join (seealsos , ", " ) + "\n " )
227218 }
228- if ! cmd .DisableAutoGenTag {
229- buf .WriteString (fmt .Sprintf ("# HISTORY\n %s Auto generated by spf13/cobra\n " , header .Date .Format ("2-Jan-2006" )))
230- }
231219 return buf .Bytes ()
232220}
0 commit comments