29 lines
571 B
Go
29 lines
571 B
Go
|
package temperature
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"os"
|
||
|
|
||
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/sensor"
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
var quiet bool
|
||
|
|
||
|
var listTemperatureSensorCmd = &cobra.Command{
|
||
|
Use: "list",
|
||
|
Short: "List Temperature Sensors",
|
||
|
Run: func(cmd *cobra.Command, args []string) {
|
||
|
|
||
|
if err := sensor.PrintTemperature(os.Stdout, configDir, quiet); err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
|
||
|
func init() {
|
||
|
temperatureSensorCmd.AddCommand(listTemperatureSensorCmd)
|
||
|
|
||
|
listTemperatureSensorCmd.Flags().BoolVarP(&quiet, "quiet", "q", false, "List only sensor id's")
|
||
|
}
|