feat(pkg/logfile): add compression

This commit is contained in:
2019-06-14 21:17:06 +02:00
parent 5666830030
commit 510819654a
5 changed files with 144 additions and 45 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/volker-raschek/flucky/pkg/sensor"
)
var compression bool
var logs bool
var readTemperatureCmd = &cobra.Command{
@ -39,7 +40,7 @@ var readTemperatureCmd = &cobra.Command{
cli.PrintTemperatures(temperatures, cnf, os.Stdout)
if logs {
err := logfile.WriteTemperatures(cnf.Device.TemperatureLogfile, temperatures)
err := logfile.WriteTemperatures(temperatures, cnf.Device.TemperatureLogfile, compression)
if err != nil {
log.Fatalln(err)
}
@ -49,6 +50,6 @@ var readTemperatureCmd = &cobra.Command{
func init() {
temperatureCmd.AddCommand(readTemperatureCmd)
// readTemperatureCmd.Flags().BoolVarP(&follow, "follow", "f", false, "Follow output")
readTemperatureCmd.Flags().BoolVarP(&logs, "logs", "l", true, "Log temperature")
readTemperatureCmd.Flags().BoolVarP(&compression, "compression", "c", true, "Compress measured with logged temperatures")
}

View File

@ -17,7 +17,6 @@ var temperatureCmd = &cobra.Command{
// Execute a
func InitCmd(cmd *cobra.Command, configPath string) {
cnfPath = configPath
cmd.AddCommand(temperatureCmd)
}