package rgbled import ( "log" "github.com/go-flucky/flucky/pkg/config" "github.com/spf13/cobra" ) var disableRgbLedCmd = &cobra.Command{ Use: "disable", Short: "Disable a RGB-LED", Args: cobra.ExactArgs(1), Example: `flucky rgb-led disable flucky rgb-led disable my-led flucky rgb-led disable 9f8abfc5-91f3-480c-a42d-b990b6f89e5d`, Run: func(cmd *cobra.Command, args []string) { // read configuration cnf, err := config.Read(*configFile) if err != nil { log.Fatalln(err) } // disable sensor entry to list err = cnf.DisableRGBLED(args[0]) if err != nil { log.Fatalln(err) } // save new configuration err = config.Write(cnf, *configFile) if err != nil { log.Fatalln(err) } }, } func init() { rgbLedCmd.AddCommand(disableRgbLedCmd) }