MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / commandTree

Function commandTree

cmd/internal/commands/doc.go:108–122  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

106}
107
108func commandTree(cmd *cobra.Command) (res command) {
109 res.Path = cmd.CommandPath()
110 res.Short = cmd.Short
111 if len(cmd.Commands()) == 0 {
112 return
113 }
114 res.SubCommands = make(map[string]command, len(cmd.Commands()))
115 for _, cmd := range cmd.Commands() {
116 if !cmd.IsAvailableCommand() || cmd.IsAdditionalHelpTopicCommand() {
117 continue
118 }
119 res.SubCommands[cmd.Name()] = commandTree(cmd)
120 }
121 return
122}
123
124// GenTree generates a JSON tree for the given root command
125func GenJSONTree(root *cobra.Command) *cobra.Command {

Callers 1

GenJSONTreeFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected