fix(cmd/temperature): list temperatures

This commit is contained in:
Markus Pesch 2019-06-15 14:02:35 +02:00
parent 2843d96756
commit 258ac998be
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -2,8 +2,13 @@ package temperature
import (
"fmt"
"log"
"os"
"github.com/spf13/cobra"
"github.com/volker-raschek/flucky/pkg/cli"
"github.com/volker-raschek/flucky/pkg/config"
"github.com/volker-raschek/flucky/pkg/logfile"
)
var listTemperatureCmd = &cobra.Command{
@ -13,12 +18,17 @@ var listTemperatureCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// read configuration
// fc, err := config.Read(cnfPath)
// if err != nil {
// list.Fatalln(err)
// }
cnf, err := config.Read(cnfPath)
if err != nil {
log.Fatalln(err)
}
//cli.PrintTemperatures(temperatures, fc, os.Stdout)
temperatures, err := logfile.ReadTemperatures(cnf.Device.TemperatureLogfile)
if err != nil {
log.Fatalln(err)
}
cli.PrintTemperatures(temperatures, cnf, os.Stdout)
},
}