PKGBUILD/cmd/config/config.go

29 lines
550 B
Go
Raw Normal View History

2018-11-19 21:36:21 +00:00
package config
import (
"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",
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)
}
},
2018-11-19 21:36:21 +00:00
}
func InitCmd(cmd *cobra.Command, c string) {
configDir = c
cmd.AddCommand(configCmd)
}