Corrected several issues identified during review

This commit is contained in:
asdf 2020-09-14 06:17:54 +10:00
parent 86ba01b1d9
commit 7dc68a18bf
3 changed files with 3 additions and 9 deletions

View File

@ -407,9 +407,6 @@ func (c *client) doCommand(action string, values []string) {
func (c *client) doCommandAs(action string, values []string) {
switch action {
case "C", "CHECK":
c.displayConfigValue(values[0])
c.DrawMessage()
case "ADD", "A":
if len(values) < 2 {
c.SetMessage(syntaxErrorMessage(action), true)
@ -502,9 +499,6 @@ func (c *client) doLinkCommandAs(action, target string, values []string) {
}
switch action {
case "C", "CHECK":
c.displayConfigValue(values[0])
c.DrawMessage()
case "ADD", "A":
bm := make([]string, 0, 5)
bm = append(bm, links[num])

View File

@ -94,10 +94,10 @@ func (p *Parser) parseAction() (*Command, error) {
case Value:
cm.Target = t.val
cm.Type = DOLINK
case Word, Action:
case Word:
cm.Value = append(cm.Value, t.val)
cm.Type = DO
case Whitespace:
case Action, Whitespace:
return nil, fmt.Errorf("Found %q (%d), expected value", t.val, t.kind)
}
t = p.scan()

View File

@ -1,6 +1,6 @@
package main
// ERRS maps commands to their help text
// ERRS maps commands to their syntax error message
var ERRS = map[string]string{
"A": "`a [target] [name...]`",
"ADD": "`add [target] [name...]`",