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" "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
Selector string Config Config
} }
type Flags struct { type Flags struct {

View File

@ -13,16 +13,8 @@ import (
const lumercFile = ".lumerc" const lumercFile = ".lumerc"
type Config struct {
AccessToken string
}
func main() { func main() {
var ( var config lumecmd.Config
selector string
)
var config 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) {
@ -41,8 +33,8 @@ func main() {
c := lifx.NewClient(config.AccessToken) c := lifx.NewClient(config.AccessToken)
cmdArgs := lumecmd.CmdArgs{ cmdArgs := lumecmd.CmdArgs{
Client: c, Client: c,
Selector: selector, Config: config,
} }
cmd, ok := lumecmd.GetCommand(command) cmd, ok := lumecmd.GetCommand(command)

View File

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