MCPcopy Index your code
hub / github.com/abiosoft/ishell / findChildCmd

Method findChildCmd

command.go:104–120  ·  view source on GitHub ↗

findChildCmd returns the subcommand with matching name or alias.

(name string)

Source from the content-addressed store, hash-verified

102
103// findChildCmd returns the subcommand with matching name or alias.
104func (c *Cmd) findChildCmd(name string) *Cmd {
105 // find perfect matches first
106 if cmd, ok := c.children[name]; ok {
107 return cmd
108 }
109
110 // find alias matching the name
111 for _, cmd := range c.children {
112 for _, alias := range cmd.Aliases {
113 if alias == name {
114 return cmd
115 }
116 }
117 }
118
119 return nil
120}
121
122// FindCmd finds the matching Cmd for args.
123// It returns the Cmd and the remaining args.

Callers 1

FindCmdMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected