Add ability to register commands

This commit is contained in:
Derek Parker
2014-05-20 18:09:34 -05:00
parent 84f80fd149
commit 8f5190cbef
2 changed files with 25 additions and 1 deletions

View File

@ -19,6 +19,10 @@ func DebugCommands() *Commands {
return &Commands{cmds}
}
func (c *Commands) Register(cmdstr string, cf cmdfunc) {
c.cmds[cmdstr] = cf
}
func (c *Commands) Find(cmdstr string) cmdfunc {
cmd, ok := c.cmds[cmdstr]
if !ok {