From 0261203395219302c4fa18987ef9cca56a15f40e Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Sat, 11 Jan 2020 17:24:34 +0100 Subject: [PATCH] fix(cmd): remove obsolete semver --- cmd/compression/compression.go | 5 +---- cmd/convert/convert.go | 6 +----- cmd/humidity/humidity.go | 6 +----- cmd/pressure/pressure.go | 3 +-- cmd/rgbled/rgbled.go | 3 +-- cmd/root.go | 16 ++++++++-------- cmd/sensor/sensor.go | 3 +-- cmd/temperature/temperature.go | 3 +-- 8 files changed, 15 insertions(+), 30 deletions(-) diff --git a/cmd/compression/compression.go b/cmd/compression/compression.go index f4c1171..c573c0d 100644 --- a/cmd/compression/compression.go +++ b/cmd/compression/compression.go @@ -3,7 +3,6 @@ package compression import ( "log" - "github.com/Masterminds/semver" "github.com/go-flucky/flucky/pkg/storage" "github.com/go-flucky/flucky/pkg/storage/logfile" @@ -13,7 +12,6 @@ import ( var ( configFile *string round float64 - version *semver.Version ) var compressionCmd = &cobra.Command{ @@ -42,9 +40,8 @@ var compressionCmd = &cobra.Command{ }, } -func InitCmd(cmd *cobra.Command, cnfFile *string, sverion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sverion cmd.AddCommand(compressionCmd) compressionCmd.Flags().Float64Var(&round, "round", 0, "Round values. The value 0 deactivates the function") diff --git a/cmd/convert/convert.go b/cmd/convert/convert.go index 3d1da86..cbac67a 100644 --- a/cmd/convert/convert.go +++ b/cmd/convert/convert.go @@ -3,7 +3,6 @@ package convert import ( "log" - "github.com/Masterminds/semver" "github.com/go-flucky/flucky/pkg/storage" "github.com/go-flucky/flucky/pkg/storage/logfile" @@ -14,8 +13,6 @@ var ( compression bool configFile *string round float64 - - version *semver.Version ) var convertCmd = &cobra.Command{ @@ -48,9 +45,8 @@ var convertCmd = &cobra.Command{ } // InitCmd ... -func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sversion cmd.AddCommand(convertCmd) convertCmd.Flags().BoolVar(&compression, "compression", false, "Compress measured values") diff --git a/cmd/humidity/humidity.go b/cmd/humidity/humidity.go index 95c9ad5..fb95e88 100644 --- a/cmd/humidity/humidity.go +++ b/cmd/humidity/humidity.go @@ -1,7 +1,6 @@ package humidity import ( - "github.com/Masterminds/semver" "github.com/spf13/cobra" ) @@ -9,8 +8,6 @@ var ( compression bool configFile *string round float64 - - version *semver.Version ) var humidityCmd = &cobra.Command{ @@ -19,9 +16,8 @@ var humidityCmd = &cobra.Command{ } // Execute a -func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sversion cmd.AddCommand(humidityCmd) diff --git a/cmd/pressure/pressure.go b/cmd/pressure/pressure.go index 07ac38f..906c3cd 100644 --- a/cmd/pressure/pressure.go +++ b/cmd/pressure/pressure.go @@ -19,9 +19,8 @@ var pressureCmd = &cobra.Command{ } // Execute a -func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sversion cmd.AddCommand(pressureCmd) diff --git a/cmd/rgbled/rgbled.go b/cmd/rgbled/rgbled.go index 379f4d2..22a7cdc 100644 --- a/cmd/rgbled/rgbled.go +++ b/cmd/rgbled/rgbled.go @@ -17,9 +17,8 @@ var rgbLedCmd = &cobra.Command{ } // InitCmd da -func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sversion cmd.AddCommand(rgbLedCmd) diff --git a/cmd/root.go b/cmd/root.go index fd21202..f631e52 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -70,13 +70,13 @@ func Execute(version *semver.Version) { rootCmd.PersistentFlags().StringVar(&configFile, "config", "/etc/flucky/config.json", "Config file") completion.InitCmd(rootCmd) - compression.InitCmd(rootCmd, &configFile, version) - convert.InitCmd(rootCmd, &configFile, version) - daemon.InitCmd(rootCmd, &configFile, version) - humidity.InitCmd(rootCmd, &configFile, version) - pressure.InitCmd(rootCmd, &configFile, version) - rgbled.InitCmd(rootCmd, &configFile, version) - sensor.InitCmd(rootCmd, &configFile, version) - temperature.InitCmd(rootCmd, &configFile, version) + compression.InitCmd(rootCmd, &configFile) + convert.InitCmd(rootCmd, &configFile) + daemon.InitCmd(rootCmd, &configFile) + humidity.InitCmd(rootCmd, &configFile) + pressure.InitCmd(rootCmd, &configFile) + rgbled.InitCmd(rootCmd, &configFile) + sensor.InitCmd(rootCmd, &configFile) + temperature.InitCmd(rootCmd, &configFile) rootCmd.Execute() } diff --git a/cmd/sensor/sensor.go b/cmd/sensor/sensor.go index 963809c..ab9d859 100644 --- a/cmd/sensor/sensor.go +++ b/cmd/sensor/sensor.go @@ -17,9 +17,8 @@ var sensorCmd = &cobra.Command{ } // InitCmd da -func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sversion cmd.AddCommand(sensorCmd) diff --git a/cmd/temperature/temperature.go b/cmd/temperature/temperature.go index d4396bf..c31b7d9 100644 --- a/cmd/temperature/temperature.go +++ b/cmd/temperature/temperature.go @@ -23,9 +23,8 @@ var temperatureCmd = &cobra.Command{ } // InitCmd initialize the subcommand -func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) { +func InitCmd(cmd *cobra.Command, cnfFile *string) { configFile = cnfFile - version = sversion cmd.AddCommand(temperatureCmd)