diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-03 14:45:33 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-03 14:45:33 (GMT) |
commit | cdf69dcc35af329584e9678a6f36f811311a82f2 (patch) | |
tree | 52beae4a84d1989ad8b73287e9252ed2359fdcff /src/rhctl | |
parent | 8da5bc7ed583e852cbdcae0170210c18551c382b (diff) |
switch command parser is now case insensitive
Diffstat (limited to 'src/rhctl')
-rw-r--r-- | src/rhctl/audio_switch_command.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rhctl/audio_switch_command.go b/src/rhctl/audio_switch_command.go index 712eee0..b71cfbd 100644 --- a/src/rhctl/audio_switch_command.go +++ b/src/rhctl/audio_switch_command.go @@ -230,7 +230,7 @@ func SwitchCommandParseState(args []string) (cmdstr SwitchCmdString, cmdargs []i err = fmt.Errorf("missing argument <state-type>") return } - switch args[0] { + switch strings.ToLower(args[0]) { case "audio": cmdstr = SwitchCmdStateAudio case "gpi": @@ -255,7 +255,7 @@ func SwitchCommandParseAudio(args []string) (cmdstr SwitchCmdString, cmdargs []i } onum := SwitchOutputNum(0) - if args[0] != "all" { + if strings.ToLower(args[0]) != "all" { if err = onum.FromString(args[0]); err != nil { return } @@ -270,7 +270,7 @@ func SwitchCommandParseAudio(args []string) (cmdstr SwitchCmdString, cmdargs []i cmdargs = append(cmdargs, inum) } - switch args[1] { + switch strings.ToLower(args[1]) { case "apply": if len(args) != 3 { err = fmt.Errorf("wrong number of arguments") @@ -360,7 +360,7 @@ func SwitchCommandParseRelay(args []string) (cmdstr SwitchCmdString, cmdargs []i return } cmdargs = append(cmdargs, num) - switch args[1] { + switch strings.ToLower(args[1]) { case "latch": cmdstr = SwitchCmdRelayLatch case "unlatch": @@ -384,7 +384,7 @@ func SwitchCommandParseOC(args []string) (cmdstr SwitchCmdString, cmdargs []inte return } cmdargs = append(cmdargs, num) - switch args[1] { + switch strings.ToLower(args[1]) { case "latch": cmdstr = SwitchCmdOCLatch case "unlatch": @@ -400,7 +400,7 @@ func SwitchCommandParseOC(args []string) (cmdstr SwitchCmdString, cmdargs []inte func NewSwitchCommandFromStrings(cmd string, args ...string) (c *SwitchCommand, err error) { c = &SwitchCommand{} - switch cmd { + switch strings.ToLower(cmd) { case "state": c.Cmd, c.Args, err = SwitchCommandParseState(args) case "out": |