fix(cli/db): remove obsolete db subcommand

This commit is contained in:
2019-12-07 18:57:41 +01:00
parent dbef4f8241
commit b125bf432c
6 changed files with 32 additions and 79 deletions

View File

@ -15,8 +15,6 @@ import (
"github.com/spf13/cobra"
)
var logs bool
var readTemperatureCmd = &cobra.Command{
Use: "read",
Short: "Reading temperature values from different or specified sensors by arguments",
@ -38,7 +36,7 @@ var readTemperatureCmd = &cobra.Command{
}
if len(sensors) == 0 {
return
log.Fatalln("No sensors found, specified or configured")
}
ctx := context.Background()
@ -47,12 +45,20 @@ var readTemperatureCmd = &cobra.Command{
log.Fatalln(err)
}
storage.Round(measuredValues, round)
measuredValues = types.SelectMeasuredValues(types.MeasuredValueTypeTemperature, measuredValues)
// print temperatures on stdout
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
// Save the new measured values, if desired
if logs {
if compression {
measuredValues = storage.Compression(measuredValues)
}
storageEndpoint, err := cnf.GetStorageEndpointURL()
if err != nil {
log.Fatalln(err)

View File

@ -10,6 +10,7 @@ import (
var (
compression bool
configFile *string
logs bool
round float64
version *semver.Version
@ -21,7 +22,7 @@ var temperatureCmd = &cobra.Command{
Example: fmt.Sprintf("flucky temperature read\nflucky temperature read outdoor"),
}
// Execute a
// InitCmd initialize the subcommand
func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) {
configFile = cnfFile
version = sversion