package temperature import ( "log" "os" "git.cryptic.systems/fh-trier/go-flucky/pkg/temperature" "github.com/spf13/cobra" ) var follow, 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.Follow(args, push, configDir, os.Stdout); err != nil { log.Fatal(err) } } else { if err := temperature.Get(args, 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") }