1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Support XDG_CONFIG_HOME

Clean up workflow and eliminate a method
One place where we calculate the full dir

Closes #699
This commit is contained in:
Sean Smith
2020-01-08 23:34:24 -05:00
parent c1f9c910e1
commit 4eeb6d67a9
3 changed files with 16 additions and 23 deletions

View File

@@ -7,6 +7,7 @@ import (
goFlags "github.com/jessevdk/go-flags"
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/help"
)
@@ -79,10 +80,10 @@ func (flags *Flags) Parse() {
}
// If no config file is explicitly passed in as a param then set the flag to the default config file
homeDir, err := os.UserHomeDir()
configDir, err := cfg.WtfConfigDir()
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
}
flags.Config = filepath.Join(homeDir, ".config", "wtf", "config.yml")
flags.Config = filepath.Join(configDir, "config.yml")
}