@@ -88,33 +88,33 @@ func (c *Client) GenAllTree() error {
88
88
}
89
89
90
90
// loadLongDescription gets long descriptions and examples from markdown.
91
- func (c * Client ) loadLongDescription (parentCmd * cobra.Command , generator string ) error {
92
- for _ , cmd := range parentCmd . Commands () {
93
- if cmd .HasSubCommands () {
94
- if err := c .loadLongDescription (cmd , generator ); err != nil {
91
+ func (c * Client ) loadLongDescription (cmd * cobra.Command , generator string ) error {
92
+ if cmd . HasSubCommands () {
93
+ for _ , sub := range cmd .Commands () {
94
+ if err := c .loadLongDescription (sub , generator ); err != nil {
95
95
return err
96
96
}
97
97
}
98
- name := cmd .CommandPath ()
99
- if i := strings .Index (name , " " ); i >= 0 {
100
- // remove root command / binary name
101
- name = name [i + 1 :]
102
- }
103
- if name == "" {
104
- continue
105
- }
106
- mdFile := strings .ReplaceAll (name , " " , "_" ) + ".md"
107
- sourcePath := filepath .Join (c .source , mdFile )
108
- content , err := os .ReadFile (sourcePath )
109
- if os .IsNotExist (err ) {
110
- log .Printf ("WARN: %s does not exist, skipping Markdown examples for %s docs\n " , mdFile , generator )
111
- continue
112
- }
113
- if err != nil {
114
- return err
115
- }
116
- applyDescriptionAndExamples (cmd , string (content ))
117
98
}
99
+ name := cmd .CommandPath ()
100
+ if i := strings .Index (name , " " ); i >= 0 {
101
+ // remove root command / binary name
102
+ name = name [i + 1 :]
103
+ }
104
+ if name == "" {
105
+ return nil
106
+ }
107
+ mdFile := strings .ReplaceAll (name , " " , "_" ) + ".md"
108
+ sourcePath := filepath .Join (c .source , mdFile )
109
+ content , err := os .ReadFile (sourcePath )
110
+ if os .IsNotExist (err ) {
111
+ log .Printf ("WARN: %s does not exist, skipping Markdown examples for %s docs\n " , mdFile , generator )
112
+ return nil
113
+ }
114
+ if err != nil {
115
+ return err
116
+ }
117
+ applyDescriptionAndExamples (cmd , string (content ))
118
118
return nil
119
119
}
120
120
0 commit comments