From 6b033f10de4f9748f00922c5740ea5b063bb2c54 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 28 Mar 2020 23:47:42 -0500 Subject: [PATCH] pass the Config struct to the commands --- cmd/command.go | 6 ++++++ cmd/lume/main.go | 7 ++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/command.go b/cmd/command.go index 21a1c71..3ddb28b 100644 --- a/cmd/command.go +++ b/cmd/command.go @@ -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 { diff --git a/cmd/lume/main.go b/cmd/lume/main.go index bb94a4a..6cfff8d 100644 --- a/cmd/lume/main.go +++ b/cmd/lume/main.go @@ -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)