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"
|
"git.kill0.net/chill9/lume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
AccessToken string
|
||||||
|
Colors map[string]string `toml:"colors"`
|
||||||
|
}
|
||||||
|
|
||||||
type CmdArgs struct {
|
type CmdArgs struct {
|
||||||
Flags Flags
|
Flags Flags
|
||||||
Client *lifx.Client
|
Client *lifx.Client
|
||||||
|
Config Config
|
||||||
}
|
}
|
||||||
|
|
||||||
type Flags struct {
|
type Flags struct {
|
||||||
|
@ -13,12 +13,8 @@ import (
|
|||||||
|
|
||||||
const lumercFile = ".lumerc"
|
const lumercFile = ".lumerc"
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
AccessToken string
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var config Config
|
var config lumecmd.Config
|
||||||
homeDir, err := os.UserHomeDir()
|
homeDir, err := os.UserHomeDir()
|
||||||
_, err = toml.DecodeFile(path.Join(homeDir, lumercFile), &config)
|
_, err = toml.DecodeFile(path.Join(homeDir, lumercFile), &config)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
@ -38,6 +34,7 @@ func main() {
|
|||||||
|
|
||||||
cmdArgs := lumecmd.CmdArgs{
|
cmdArgs := lumecmd.CmdArgs{
|
||||||
Client: c,
|
Client: c,
|
||||||
|
Config: config,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd, ok := lumecmd.GetCommand(command)
|
cmd, ok := lumecmd.GetCommand(command)
|
||||||
|
Loading…
Reference in New Issue
Block a user