1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-02 09:17:19 -04:00
OpenDiablo2/d2core/d2term/commmand.go
2020-12-21 21:46:58 +01:00

34 lines
578 B
Go

package d2term
import (
"sort"
)
func (t *Terminal) commandList([]string) error {
names := make([]string, 0, len(t.commands))
for name := range t.commands {
names = append(names, name)
}
sort.Strings(names)
t.Infof("available actions (%d):", len(names))
for _, name := range names {
entry := t.commands[name]
if entry.arguments != nil {
t.Infof("%s: %s; %v", name, entry.description, entry.arguments)
continue
}
t.Infof("%s: %s", name, entry.description)
}
return nil
}
func (t *Terminal) commandClear([]string) error {
t.Clear()
return nil
}