From ec673a6fde9b05327bb14b12f4e828b3bba2d9e9 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 24 Jan 2021 20:50:10 -0600 Subject: [PATCH] Return usage error if no color is provided --- cmd/setcolor.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/setcolor.go b/cmd/setcolor.go index 70247e0..e616799 100644 --- a/cmd/setcolor.go +++ b/cmd/setcolor.go @@ -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{}