add: humidity (WIP)
This commit is contained in:
@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"git.cryptic.systems/fh-trier/go-flucky/cmd/config"
|
||||
"git.cryptic.systems/fh-trier/go-flucky/cmd/humidity"
|
||||
"git.cryptic.systems/fh-trier/go-flucky/cmd/remote"
|
||||
"git.cryptic.systems/fh-trier/go-flucky/cmd/sensor"
|
||||
"git.cryptic.systems/fh-trier/go-flucky/cmd/temperature"
|
||||
@ -22,6 +23,7 @@ func Execute(version string) {
|
||||
rootCmd.PersistentFlags().StringVarP(&configDir, "config", "c", "/etc/flucky", "The base directory for all configuration files.")
|
||||
|
||||
config.InitCmd(rootCmd, configDir)
|
||||
humidity.InitCmd(rootCmd, configDir)
|
||||
remote.InitCmd(rootCmd, configDir)
|
||||
sensor.InitCmd(rootCmd, configDir)
|
||||
temperature.InitCmd(rootCmd, configDir)
|
||||
|
28
cmd/humidity/get.go
Normal file
28
cmd/humidity/get.go
Normal file
@ -0,0 +1,28 @@
|
||||
package humidity
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.cryptic.systems/fh-trier/go-flucky/pkg/humidity"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var follow, push bool
|
||||
|
||||
var getHumidityCmd = &cobra.Command{
|
||||
Use: "get",
|
||||
Short: "get humidity from sensor",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
if err := humidity.Get(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
humidityCmd.AddCommand(getHumidityCmd)
|
||||
// getTemperatureCmd.Flags().BoolVarP(&follow, "follow", "f", false, "Follow output")
|
||||
// getTemperatureCmd.Flags().BoolVarP(&push, "push", "p", false, "Push to remote server")
|
||||
}
|
20
cmd/humidity/humidity.go
Normal file
20
cmd/humidity/humidity.go
Normal file
@ -0,0 +1,20 @@
|
||||
package humidity
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var configDir string
|
||||
|
||||
var humidityCmd = &cobra.Command{
|
||||
Use: "humidity",
|
||||
Short: "Read humidity from sensor",
|
||||
}
|
||||
|
||||
// Execute a
|
||||
func InitCmd(cmd *cobra.Command, cnf string) {
|
||||
configDir = cnf
|
||||
|
||||
cmd.AddCommand(humidityCmd)
|
||||
|
||||
}
|
Reference in New Issue
Block a user