Markus Pesch
f8e829d3d2
changes: - add sync command to synchronize device sensor information with remote servers - fix fetch functions to get temperatures
29 lines
550 B
Go
29 lines
550 B
Go
package config
|
|
|
|
import (
|
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/config"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var configDir string
|
|
|
|
var configCmd = &cobra.Command{
|
|
Use: "config",
|
|
Short: "Manage Configuration",
|
|
Args: cobra.ExactArgs(2),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if args[0] == "device.name" {
|
|
config.DeviceName(args[1], configDir)
|
|
} else if args[0] == "device.location" {
|
|
config.DeviceLocation(args[1], configDir)
|
|
}
|
|
},
|
|
}
|
|
|
|
func InitCmd(cmd *cobra.Command, c string) {
|
|
configDir = c
|
|
|
|
cmd.AddCommand(configCmd)
|
|
|
|
}
|