feat(cmd/rgb-led): add subcommands to operate with rgb-leds
This commit is contained in:
@ -68,6 +68,21 @@ func PrintHumidities(humidities []*types.Humidity, cnf *config.Configuration, w
|
||||
tw.Flush()
|
||||
}
|
||||
|
||||
func PrintRGBLEDs(cnf *config.Configuration, w io.Writer) {
|
||||
|
||||
// declare tabwriter
|
||||
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
|
||||
|
||||
// headline
|
||||
fmt.Fprintln(tw, "name\tlocation\tblue\tgreen\tred\tenabled")
|
||||
|
||||
for _, rgbled := range cnf.RGBLEDs {
|
||||
fmt.Fprintf(tw, "%v\t%v\t%v\t%v\t%v\t%v\n", rgbled.RGBLEDName, rgbled.RGBLEDLocation, *rgbled.RGBLEDColorToGPIO[types.RGBLEDBlue], *rgbled.RGBLEDColorToGPIO[types.RGBLEDGreen], *rgbled.RGBLEDColorToGPIO[types.RGBLEDRed], rgbled.RGBLEDEnabled)
|
||||
}
|
||||
|
||||
tw.Flush()
|
||||
}
|
||||
|
||||
// PrintSensors displays a list with all configured sensors
|
||||
func PrintSensors(cnf *config.Configuration, w io.Writer) error {
|
||||
|
||||
|
Reference in New Issue
Block a user