From 22fcad2fedac8625aab6c15d6da82a607615d692 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 7 Mar 2024 13:07:24 -0500 Subject: [PATCH] Implement error messages for missing key values in libmutton.ini --- src/offline/configParser.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/offline/configParser.go b/src/offline/configParser.go index 2926ec9..45348a7 100644 --- a/src/offline/configParser.go +++ b/src/offline/configParser.go @@ -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