MCPcopy Create free account
hub / github.com/dropbox/dbxcli / walkCommands

Function walkCommands

tools/gen-docs/main.go:103–121  ·  view source on GitHub ↗
(command *cobra.Command, fn func(*cobra.Command) error)

Source from the content-addressed store, hash-verified

101}
102
103func 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
123func insertMetadataSection(contents []byte, section []byte) []byte {
124 marker := []byte("\n### SEE ALSO\n\n")

Callers 1

addCommandMetadataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected