disable.go 557 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/spf13/cobra"
  5. )
  6. func NewDisableCmd() *cobra.Command {
  7. return &cobra.Command{
  8. Use: "disable",
  9. Short: "Disable RGB lighting",
  10. Args: cobra.NoArgs,
  11. RunE: func(cmd *cobra.Command, args []string) error {
  12. proto, _, channels, err := openTarget()
  13. if err != nil {
  14. return err
  15. }
  16. defer proto.Close()
  17. if err := disableLightingOnChannels(proto, channels); err != nil {
  18. return fmt.Errorf("disable RGB: %w", err)
  19. }
  20. fmt.Fprintln(cmd.OutOrStdout(), "RGB disabled")
  21. return nil
  22. },
  23. }
  24. }