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 }