Browse Source

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

rudi9719/bugs/editing-nontext-messages
Gregory Rudolph 5 years ago
parent
commit
1a75ac8a49
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 6
      cmdSet.go

6
cmdSet.go

@ -69,7 +69,11 @@ func cmdSet(cmd []string) { @@ -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)

Loading…
Cancel
Save