You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
897 B

5 years ago
// +build !rm_basic_commands allcommands helpcmd
package main
import (
"fmt"
"sort"
"strings"
5 years ago
)
func init() {
command := Command{
Cmd: []string{"help", "h"},
5 years ago
Description: "Show information about available commands",
5 years ago
Help: "",
Exec: cmdHelp,
}
RegisterCommand(command)
}
5 years ago
func cmdHelp(cmd []string) {
5 years ago
var helpText string
var tCommands []string
5 years ago
if len(cmd) == 1 {
sort.Strings(baseCommands)
for _, c := range baseCommands {
helpText = fmt.Sprintf("%s%s%s\t\t%s\n", helpText, config.Basics.CmdPrefix, c, commands[c].Description)
5 years ago
}
if len(typeCommands) > 0 {
5 years ago
for c := range typeCommands {
tCommands = append(tCommands, typeCommands[c].Name)
}
sort.Strings(tCommands)
helpText = fmt.Sprintf("%s\nThe following Type Commands are currently loaded: %s", helpText, strings.Join(tCommands, ", "))
}
5 years ago
}
5 years ago
printToView("Chat", helpText)
5 years ago
}