Initial import.

This commit is contained in:
2021-04-19 13:10:40 -07:00
commit 42aa585bd0
16 changed files with 863 additions and 0 deletions

22
cps/help.go Normal file
View 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
}