diff --git a/cmd/temperature/list.go b/cmd/temperature/list.go index b2de2e2..81fbf9f 100644 --- a/cmd/temperature/list.go +++ b/cmd/temperature/list.go @@ -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) }, }