Implement error messages for missing key values in libmutton.ini

This commit is contained in:
2024-03-07 13:07:24 -05:00
parent b1f3a9eeec
commit 22fcad2fed
+9 -1
View File
@@ -19,7 +19,15 @@ func ReadConfig(readKeys []string) []string {
var config []string
for _, key := range readKeys {
config = append(config, cfg.Section("LIBMUTTON").Key(key).String())
keyConfig := cfg.Section("LIBMUTTON").Key(key).String()
// ensure specified key has a value
if keyConfig == "" {
fmt.Println(AnsiError + "Failed to find value for key \"" + key + "\" in section \"[LIBMUTTON]\" in libmutton.ini" + AnsiReset)
os.Exit(1)
}
config = append(config, keyConfig)
}
return config