fix(pkg/types): use measured values as struct instead interface

This commit is contained in:
2019-07-02 22:33:01 +02:00
parent d703d33e08
commit 825511c3b5
23 changed files with 218 additions and 659 deletions

View File

@ -5,11 +5,12 @@ import (
"log"
"os"
"github.com/go-flucky/flucky/pkg/types"
"github.com/go-flucky/flucky/pkg/cli"
"github.com/go-flucky/flucky/pkg/config"
"github.com/go-flucky/flucky/pkg/logfile"
"github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/types/typeswitch"
"github.com/spf13/cobra"
)
@ -41,7 +42,7 @@ var listTemperatureCmd = &cobra.Command{
log.Fatalln(err)
}
measuredValues = typeswitch.HumidityValues(measuredValues)
measuredValues = types.SelectMeasuredValues(types.MeasuredValueTypeHumidity, measuredValues)
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)

View File

@ -5,12 +5,12 @@ import (
"log"
"os"
"github.com/go-flucky/flucky/pkg/logfile"
"github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/types/typeswitch"
"github.com/go-flucky/flucky/pkg/types"
"github.com/go-flucky/flucky/pkg/cli"
"github.com/go-flucky/flucky/pkg/config"
"github.com/go-flucky/flucky/pkg/logfile"
"github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/sensor"
"github.com/spf13/cobra"
)
@ -51,7 +51,7 @@ var readHumidityCmd = &cobra.Command{
log.Fatalln(err)
}
measuredValues = typeswitch.HumidityValues(measuredValues)
measuredValues = types.SelectMeasuredValues(types.MeasuredValueTypeHumidity, measuredValues)
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)

View File

@ -5,11 +5,12 @@ import (
"log"
"os"
"github.com/go-flucky/flucky/pkg/types"
"github.com/go-flucky/flucky/pkg/cli"
"github.com/go-flucky/flucky/pkg/config"
"github.com/go-flucky/flucky/pkg/logfile"
"github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/types/typeswitch"
"github.com/spf13/cobra"
)
@ -41,7 +42,7 @@ var listTemperatureCmd = &cobra.Command{
log.Fatalln(err)
}
measuredValues = typeswitch.TemperatureValues(measuredValues)
measuredValues = types.SelectMeasuredValues(types.MeasuredValueTypeTemperature, measuredValues)
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)

View File

@ -6,9 +6,8 @@ import (
"log"
"os"
"github.com/go-flucky/flucky/pkg/types/typeswitch"
"github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/types"
"github.com/go-flucky/flucky/pkg/cli"
"github.com/go-flucky/flucky/pkg/config"
@ -55,7 +54,7 @@ var readTemperatureCmd = &cobra.Command{
log.Fatalln(err)
}
measuredValues = typeswitch.TemperatureValues(measuredValues)
measuredValues = types.SelectMeasuredValues(types.MeasuredValueTypeTemperature, measuredValues)
// print temperatures on stdout
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)