Return usage error if no color is provided

This commit is contained in:
Ryan Cavicchioni 2021-01-24 20:50:10 -06:00
parent f2da3dadd7
commit ec673a6fde
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -3,6 +3,7 @@ package lumecmd
import (
"flag"
"fmt"
"os"
lifx "git.kill0.net/chill9/lume"
)
@ -52,8 +53,6 @@ func SetColorCmd(args CmdArgs) (int, error) {
state := lifx.State{}
selector := args.Flags.String("selector")
fmt.Println(args.Config)
power := args.Flags.String("power")
if power != "" {
state.Power = power
@ -64,6 +63,11 @@ func SetColorCmd(args CmdArgs) (int, error) {
rgbFlag := args.Flags.String("rgb")
name := args.Flags.String("name")
if (hueFlag == "" || saturationFlag == "") && rgbFlag == "" && name == "" {
printCmdHelp(os.Args[1])
return ExitError, nil
}
if hueFlag != "" || saturationFlag != "" {
color := lifx.HSBKColor{}