Compare commits

...

3 Commits

Author SHA1 Message Date
6b033f10de
pass the Config struct to the commands 2020-03-28 23:47:42 -05:00
968b098344
fix incorrect comand name 2020-03-28 23:45:27 -05:00
8b2a67b73b
remove dead code 2020-03-28 18:13:15 -05:00
3 changed files with 12 additions and 15 deletions

View File

@ -8,10 +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
Selector string
Flags Flags
Client *lifx.Client
Config Config
}
type Flags struct {

View File

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

View File

@ -6,7 +6,7 @@ import (
)
func init() {
var cmdName string = "set-state"
var cmdName string = "toggle"
fs := flag.NewFlagSet(cmdName, flag.ExitOnError)