31 lines
534 B
Go
31 lines
534 B
Go
package rgbled
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/go-flucky/flucky/pkg/cli"
|
|
"github.com/go-flucky/flucky/pkg/config"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var listRgbLedCmd = &cobra.Command{
|
|
Use: "list",
|
|
Short: "List RGB-LEDs",
|
|
Aliases: []string{"ls"},
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// read configuration
|
|
cnf, err := config.Read(*configFile)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
// print sensors on stdout
|
|
cli.PrintRGBLEDs(cnf, os.Stdout)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rgbLedCmd.AddCommand(listRgbLedCmd)
|
|
}
|