Initial import.
This commit is contained in:
22
cps/help.go
Normal file
22
cps/help.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package cps
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Register("help", helpHandler)
|
||||
}
|
||||
|
||||
func helpHandler(cmd *Command) (*Response, error) {
|
||||
knownCommands := make([]string, 0, len(registry))
|
||||
for command := range registry {
|
||||
knownCommands = append(knownCommands, command)
|
||||
}
|
||||
|
||||
sort.Strings(knownCommands)
|
||||
return &Response{
|
||||
Message: strings.Join(knownCommands, ", "),
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user