pass the Config struct to the commands

This commit is contained in:
Ryan Cavicchioni 2020-03-28 23:47:42 -05:00
parent 968b098344
commit 6b033f10de
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 8 additions and 5 deletions

View File

@ -8,9 +8,15 @@ import (
"git.kill0.net/chill9/lume"
)
type Config struct {
AccessToken string
Colors map[string]string `toml:"colors"`
}
type CmdArgs struct {
Flags Flags
Client *lifx.Client
Config Config
}
type Flags struct {

View File

@ -13,12 +13,8 @@ import (
const lumercFile = ".lumerc"
type Config struct {
AccessToken string
}
func main() {
var config Config
var config lumecmd.Config
homeDir, err := os.UserHomeDir()
_, err = toml.DecodeFile(path.Join(homeDir, lumercFile), &config)
if os.IsNotExist(err) {
@ -38,6 +34,7 @@ func main() {
cmdArgs := lumecmd.CmdArgs{
Client: c,
Config: config,
}
cmd, ok := lumecmd.GetCommand(command)