| 1234567891011121314151617181920212223242526272829 |
- package main
- import (
- "fmt"
- "github.com/spf13/cobra"
- )
- func NewDisableCmd() *cobra.Command {
- return withZoneArgs(&cobra.Command{
- Use: "disable <zone>",
- Short: "Disable RGB lighting on a zone",
- Long: writesLighting("Turn the lighting off on the named channels, by writing brightness 0."),
- RunE: func(cmd *cobra.Command, args []string) error {
- proto, _, channels, err := openTarget(args[0])
- if err != nil {
- return err
- }
- defer proto.Close()
- if err := disableLightingOnChannels(proto, channels); err != nil {
- return fmt.Errorf("disable RGB: %w", err)
- }
- fmt.Fprintln(cmd.OutOrStdout(), "RGB disabled")
- return nil
- },
- }, 1, 1, "a zone")
- }
|