pass the Config struct to the commands
This commit is contained in:
parent
968b098344
commit
6b033f10de
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user