MCPcopy Create free account
hub / github.com/diillson/chatcli / lookup

Method lookup

cli/command_handler.go:141–151  ·  view source on GitHub ↗

lookup resolves the handler for an input: exact match first, then the ordered prefix routes. ok is false when nothing matches (chat/skill input).

(userInput string)

Source from the content-addressed store, hash-verified

139// lookup resolves the handler for an input: exact match first, then the
140// ordered prefix routes. ok is false when nothing matches (chat/skill input).
141func (ch *CommandHandler) lookup(userInput string) (cmdFunc, bool) {
142 if fn, ok := ch.routes.exact[userInput]; ok {
143 return fn, true
144 }
145 for _, r := range ch.routes.prefixes {
146 if r.matches(userInput) {
147 return r.fn, true
148 }
149 }
150 return nil, false
151}
152
153// handleDefault treats "/<name> [args]" as a manual skill invocation when
154// <name> resolves to an installed user-invocable skill; otherwise it reports

Callers 2

HandleCommandMethod · 0.95

Calls 1

matchesMethod · 0.45

Tested by 1