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

Method FindCmd

command.go:124–135  ·  view source on GitHub ↗

FindCmd finds the matching Cmd for args. It returns the Cmd and the remaining args.

(args []string)

Source from the content-addressed store, hash-verified

122// FindCmd finds the matching Cmd for args.
123// It returns the Cmd and the remaining args.
124func (c Cmd) FindCmd(args []string) (*Cmd, []string) {
125 var cmd *Cmd
126 for i, arg := range args {
127 if cmd1 := c.findChildCmd(arg); cmd1 != nil {
128 cmd = cmd1
129 c = *cmd
130 continue
131 }
132 return cmd, args[i:]
133 }
134 return cmd, nil
135}
136
137type cmdSorter []*Cmd
138

Callers 4

getWordsMethod · 0.80
handleCommandMethod · 0.80
TestFindCmdFunction · 0.80
TestFindAliasFunction · 0.80

Calls 1

findChildCmdMethod · 0.95

Tested by 2

TestFindCmdFunction · 0.64
TestFindAliasFunction · 0.64