2018-11-19 21:36:21 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2018-11-28 11:54:14 +00:00
|
|
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/config"
|
2018-11-19 21:36:21 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var configDir string
|
|
|
|
|
|
|
|
var configCmd = &cobra.Command{
|
|
|
|
Use: "config",
|
2018-11-28 11:54:14 +00:00
|
|
|
Short: "Manage Configuration",
|
2018-11-29 15:06:39 +00:00
|
|
|
Args: cobra.ExactArgs(2),
|
2018-11-28 11:54:14 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
},
|
2018-11-19 21:36:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func InitCmd(cmd *cobra.Command, c string) {
|
|
|
|
configDir = c
|
|
|
|
|
|
|
|
cmd.AddCommand(configCmd)
|
|
|
|
|
|
|
|
}
|