29 lines
601 B
Go
29 lines
601 B
Go
package temperature
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
temperatureSensor "git.cryptic.systems/fh-trier/go-flucky/pkg/sensor/temperature"
|
|
"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 := temperatureSensor.Print(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")
|
|
}
|