| 12345678910111213141516171819202122232425262728293031323334353637 |
- package main
- import (
- "fmt"
- "os"
- "github.com/spf13/cobra"
- )
- func NewEnableCmd() *cobra.Command {
- return &cobra.Command{
- Use: "enable",
- Short: "Enable RGB lighting",
- Args: cobra.NoArgs,
- Run: func(cmd *cobra.Command, args []string) {
- zones, err := selectedZones()
- if err != nil {
- fmt.Fprintf(os.Stderr, "Error: %v\n", err)
- os.Exit(1)
- }
- proto, err := OpenDevice()
- if err != nil {
- fmt.Fprintf(os.Stderr, "Error: %v\n", err)
- os.Exit(1)
- }
- defer proto.Close()
- if err := enableLightingOnZones(proto, zones); err != nil {
- fmt.Fprintf(os.Stderr, "Error enabling RGB: %v\n", err)
- os.Exit(1)
- }
- fmt.Println("RGB enabled")
- },
- }
- }
|