|
|
@ -40,6 +40,8 @@ func (c CommandSet) GetCommand(name string) *Command {
|
|
|
|
return &helpCommand
|
|
|
|
return &helpCommand
|
|
|
|
case "commands":
|
|
|
|
case "commands":
|
|
|
|
return &commandsCommand
|
|
|
|
return &commandsCommand
|
|
|
|
|
|
|
|
case "status":
|
|
|
|
|
|
|
|
return &statusCommand
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, cmd := range c {
|
|
|
|
for _, cmd := range c {
|
|
|
|
if cmd.name == name {
|
|
|
|
if cmd.name == name {
|
|
|
@ -50,7 +52,7 @@ func (c CommandSet) GetCommand(name string) *Command {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (c CommandSet) Commands() []Command {
|
|
|
|
func (c CommandSet) Commands() []Command {
|
|
|
|
return append([]Command(c), helpCommand, commandsCommand)
|
|
|
|
return append([]Command(c), statusCommand, helpCommand, commandsCommand)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var helpCommand = Command{
|
|
|
|
var helpCommand = Command{
|
|
|
@ -100,6 +102,14 @@ are farther away take longer to communicate with.
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var statusCommand = Command{
|
|
|
|
|
|
|
|
name: "status",
|
|
|
|
|
|
|
|
help: "display your current status",
|
|
|
|
|
|
|
|
handler: func(conn *Connection, args ...string) {
|
|
|
|
|
|
|
|
conn.ConnectionState.PrintStatus(conn)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this isn't a real command it just puts command in the list of commands, this
|
|
|
|
// this isn't a real command it just puts command in the list of commands, this
|
|
|
|
// is weird and circular, this is a special case.
|
|
|
|
// is weird and circular, this is a special case.
|
|
|
|
var commandsCommand = Command{
|
|
|
|
var commandsCommand = Command{
|
|
|
|