Feature #17 - load ~/.config/kbtui.toml if it exists, otherwise use toml in dir

This commit is contained in:
2019-10-24 09:51:22 -04:00
parent 55ac19beb3
commit 1a75ac8a49

View File

@ -69,7 +69,11 @@ func cmdSet(cmd []string) {
func loadFromToml() {
configFile, env := os.LookupEnv("KBTUI_CFG")
if !env {
configFile = "kbtui.toml"
configFile = "~/.config/kbtui.toml"
if _, err := os.Stat(configFile); os.IsNotExist(err) {
configFile = "kbtui.toml"
}
}
printInfoF("Loading config from toml: $TEXT", messageAttachmentColor.stylize(configFile))
config, err := toml.LoadFile(configFile)