fix: first temperature post request
This commit is contained in:
20
cmd/cmd.go
Normal file
20
cmd/cmd.go
Normal file
@ -0,0 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"git.cryptic.systems/fh-trier/go-flucky/cmd/temperature"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "flucky",
|
||||
Short: "Read from sensors",
|
||||
}
|
||||
|
||||
// Execute a
|
||||
func Execute(version string) {
|
||||
rootCmd.Version = version
|
||||
|
||||
temperature.InitCmd(rootCmd)
|
||||
|
||||
rootCmd.Execute()
|
||||
}
|
25
cmd/temperature/temperature.go
Normal file
25
cmd/temperature/temperature.go
Normal file
@ -0,0 +1,25 @@
|
||||
package temperature
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"git.cryptic.systems/fh-trier/go-flucky/pkg/temperature"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var temperatureCmd = &cobra.Command{
|
||||
Use: "temperature",
|
||||
Short: "temperature",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if err := temperature.Print(os.Stdout); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func InitCmd(cmd *cobra.Command) {
|
||||
|
||||
cmd.AddCommand(temperatureCmd)
|
||||
|
||||
}
|
Reference in New Issue
Block a user