you must call the function before calling console.Init goroutine not safe
(name string, help string, f interface{}, server *chanrpc.Server)
| 61 | // you must call the function before calling console.Init |
| 62 | // goroutine not safe |
| 63 | func 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 |
| 80 | type CommandHelp struct{} |