aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2017-02-13 18:54:25 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2017-02-13 18:54:25 +0100
commit0e3ea604c1fccfeb00d7fa8e7490843f3be50e42 (patch)
tree42de9fec62fbe37a298892ba88cd5abbb0708fe9
parent640de962f91d90d37cba804acba6b570092b49dc (diff)
downloadgoffel-0e3ea604c1fccfeb00d7fa8e7490843f3be50e42.tar.gz
goffel-0e3ea604c1fccfeb00d7fa8e7490843f3be50e42.zip
cmd: allow long command names
-rw-r--r--logic/cmd.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/logic/cmd.go b/logic/cmd.go
index 26a3385..89afc5c 100644
--- a/logic/cmd.go
+++ b/logic/cmd.go
@@ -39,9 +39,13 @@ func ParseCmd(s string) (Cmd, error) {
argc := 0
switch split[0] {
- case "d", "p", "q":
+ case "d", "dices":
+ fallthrough
+ case "p", "print":
+ fallthrough
+ case "q", "quit":
return Cmd{Cmd: split[0]}, nil
- case "h":
+ case "h", "help":
if len(split) > 1 {
if i, exists := cmdTable[split[1]]; exists {
argv = append(argv, i)
@@ -52,7 +56,8 @@ func ParseCmd(s string) (Cmd, error) {
argv = append(argv, 0)
argc++
}
- case "i", "c":
+ case "i", "insert": fallthrough
+ case "c", "cancel":
if len(split) < 2 {
return Cmd{}, errors.New(split[0] + ": missing argument")
}
@@ -66,7 +71,7 @@ func ParseCmd(s string) (Cmd, error) {
argv = append(argv, i-1)
}
argc++
- case "r":
+ case "r", "reroll":
for _, v := range split[1:] {
i, err := strconv.Atoi(v)
if err != nil {
@@ -82,7 +87,7 @@ func ParseCmd(s string) (Cmd, error) {
break
}
}
- case "pos":
+ case "pos", "position":
split[0] = "h"
argv = append(argv, cmdTable["pos"])
argc++