package temperature import ( "log" "os" "git.cryptic.systems/fh-trier/go-flucky/pkg/temperature" "github.com/spf13/cobra" ) var follow, writeLogfiles, push bool var getTemperatureCmd = &cobra.Command{ Use: "get", Short: "get temperature from sensor", Run: func(cmd *cobra.Command, args []string) { if follow { if err := temperature.GetFollow(args, writeLogfiles, push, configDir, os.Stdout); err != nil { log.Fatal(err) } } else { if err := temperature.Get(args, writeLogfiles, push, configDir, os.Stdout); err != nil { log.Fatal(err) } } }, } func init() { temperatureCmd.AddCommand(getTemperatureCmd) getTemperatureCmd.Flags().BoolVarP(&follow, "follow", "f", false, "Follow output") getTemperatureCmd.Flags().BoolVarP(&push, "push", "p", false, "Push to remote server") getTemperatureCmd.Flags().BoolVarP(&writeLogfiles, "log", "l", true, "Write to logfiles") }