MCPcopy
hub / github.com/name5566/leaf / Register

Function Register

console/command.go:63–77  ·  view source on GitHub ↗

you must call the function before calling console.Init goroutine not safe

(name string, help string, f interface{}, server *chanrpc.Server)

Source from the content-addressed store, hash-verified

61// you must call the function before calling console.Init
62// goroutine not safe
63func Register(name string, help string, f interface{}, server *chanrpc.Server) {
64 for _, c := range commands {
65 if c.name() == name {
66 log.Fatal("command %v is already registered", name)
67 }
68 }
69
70 server.Register(name, f)
71
72 c := new(ExternalCommand)
73 c._name = name
74 c._help = help
75 c.server = server
76 commands = append(commands, c)
77}
78
79// help
80type CommandHelp struct{}

Callers

nothing calls this directly

Calls 3

FatalMethod · 0.80
nameMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected