MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / findCommand

Method findCommand

server/command/manager.go:69–92  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

67}
68
69func (mgr *Manager) findCommand(name string) *Command {
70 mgr.mu.RLock()
71 defer mgr.mu.RUnlock()
72
73 var namespace string
74 if i := strings.Index(name, ":"); i != -1 && i != len(name) {
75 namespace = name[:i]
76 name = name[i+1:]
77 }
78 for _, cmd := range mgr.commands {
79 if namespace != "" && cmd.Namespace != namespace {
80 continue
81 }
82 if cmd.Node.Name == name {
83 return &cmd
84 }
85 for _, alias := range cmd.Aliases {
86 if alias == name {
87 return &cmd
88 }
89 }
90 }
91 return nil
92}

Callers 1

CallMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected