Validate flags before running the command
This commit is contained in:
parent
8c6567bc8a
commit
8e7ff7f39a
@ -37,6 +37,11 @@ func SetStateCmd(args CmdArgs) (int, error) {
|
||||
fast := args.Flags.Bool("fast")
|
||||
state.Fast = fast
|
||||
|
||||
if power == "" && color == "" && brightnessFlag == "" && infraredFlag == "" {
|
||||
printCmdHelp(args.Name)
|
||||
return ExitFailure, nil
|
||||
}
|
||||
|
||||
r, err := c.SetState(selector, state)
|
||||
if err != nil {
|
||||
return ExitFailure, err
|
||||
|
@ -52,6 +52,11 @@ func SetWhiteCmd(args CmdArgs) (int, error) {
|
||||
fast := args.Flags.Bool("fast")
|
||||
state.Fast = fast
|
||||
|
||||
if power == "" && kelvinFlag == "" && name == "" && brightnessFlag == "" && infraredFlag == "" {
|
||||
printCmdHelp(args.Name)
|
||||
return ExitFailure, nil
|
||||
}
|
||||
|
||||
r, err := c.SetState(selector, state)
|
||||
if err != nil {
|
||||
return ExitFailure, err
|
||||
|
Loading…
Reference in New Issue
Block a user