1
+ //go:build mage
2
+ // +build mage
3
+
1
4
package main
2
5
3
6
import (
@@ -23,7 +26,6 @@ func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
23
26
func (s byName ) Less (i , j int ) bool { return s [i ].Name () < s [j ].Name () }
24
27
25
28
func GenCustomMarkdownTree (cmd * cobra.Command , dir string ) error {
26
-
27
29
basename := strings .ReplaceAll (cmd .CommandPath (), " " , "_" ) + ".md"
28
30
filename := filepath .Join (dir , basename )
29
31
@@ -34,7 +36,6 @@ func GenCustomMarkdownTree(cmd *cobra.Command, dir string) error {
34
36
defer f .Close ()
35
37
36
38
return genMarkdownTreeCustom (cmd , f )
37
-
38
39
}
39
40
40
41
func genMarkdownTreeCustom (cmd * cobra.Command , f * os.File ) error {
@@ -132,7 +133,6 @@ func hasSeeAlso(cmd *cobra.Command) bool {
132
133
}
133
134
134
135
func printOptions (buf * bytes.Buffer , cmd * cobra.Command ) error {
135
-
136
136
flags := cmd .NonInheritedFlags ()
137
137
flags .SetOutput (buf )
138
138
@@ -145,12 +145,11 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command) error {
145
145
parentFlags := cmd .InheritedFlags ()
146
146
parentFlags .SetOutput (buf )
147
147
148
- if flags .HasAvailableFlags () {
148
+ if parentFlags .HasAvailableFlags () {
149
149
buf .WriteString ("### Options Inherited From Parent Flags\n \n ```\n " )
150
- flags .PrintDefaults ()
150
+ parentFlags .PrintDefaults ()
151
151
buf .WriteString ("```\n \n " )
152
152
}
153
153
154
154
return nil
155
-
156
155
}
0 commit comments