go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/experiments/huectl/pkg/command/set_group_on.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package command 9 10 import ( 11 "github.com/urfave/cli/v2" 12 ) 13 14 // SetGroupOn returns a command. 15 func SetGroupOn() *cli.Command { 16 return &cli.Command{ 17 Name: "set-group-on", 18 Usage: "Set all of a given group's lights on.", 19 Flags: append(DefaultFlags, GroupFlags...), 20 Action: func(c *cli.Context) error { 21 group, _, err := groupHelper(c) 22 if err != nil { 23 return err 24 } 25 26 if err = group.On(c.Context); err != nil { 27 return err 28 } 29 30 printf(c, "group %q turned on\n", group.Name) 31 return nil 32 }, 33 } 34 }