(command *cobra.Command, fn func(*cobra.Command) error)
| 101 | } |
| 102 | |
| 103 | func walkCommands(command *cobra.Command, fn func(*cobra.Command) error) error { |
| 104 | if !command.IsAvailableCommand() || command.IsAdditionalHelpTopicCommand() { |
| 105 | return nil |
| 106 | } |
| 107 | if err := fn(command); err != nil { |
| 108 | return err |
| 109 | } |
| 110 | |
| 111 | children := append([]*cobra.Command{}, command.Commands()...) |
| 112 | sort.Slice(children, func(i, j int) bool { |
| 113 | return children[i].Name() < children[j].Name() |
| 114 | }) |
| 115 | for _, child := range children { |
| 116 | if err := walkCommands(child, fn); err != nil { |
| 117 | return err |
| 118 | } |
| 119 | } |
| 120 | return nil |
| 121 | } |
| 122 | |
| 123 | func insertMetadataSection(contents []byte, section []byte) []byte { |
| 124 | marker := []byte("\n### SEE ALSO\n\n") |
no outgoing calls
no test coverage detected