2018-11-20 21:55:06 +00:00
|
|
|
package temperature
|
2018-11-19 21:36:21 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/temperature"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2018-11-20 21:55:06 +00:00
|
|
|
var push bool
|
|
|
|
|
2018-11-19 21:36:21 +00:00
|
|
|
var getTemperatureCmd = &cobra.Command{
|
|
|
|
Use: "get",
|
|
|
|
Short: "get temperature from sensor",
|
2018-11-20 21:55:06 +00:00
|
|
|
Args: cobra.ExactArgs(1),
|
2018-11-19 21:36:21 +00:00
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
|
2018-11-20 21:55:06 +00:00
|
|
|
if err := temperature.Get(os.Stdout, args[0], configDir); err != nil {
|
2018-11-19 21:36:21 +00:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
temperatureCmd.AddCommand(getTemperatureCmd)
|
|
|
|
}
|