config: prevent empty values for required configs (#176)

* config: prevent empty values for required configs

Fixes #147

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* fix

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

---------

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
diff --git a/config/config.go b/config/config.go
index 1619363..bcd3f6f 100644
--- a/config/config.go
+++ b/config/config.go
@@ -46,6 +46,13 @@
 	DEFAULT = "default"
 )
 
+var nonEmptyConfigKeys = map[string]bool{
+	"output":  true,
+	"timeout": true,
+	"profile": true,
+	"url":     true,
+}
+
 // DefaultACSAPIEndpoint is the default API endpoint for CloudStack.
 const DefaultACSAPIEndpoint = "http://localhost:8080/client/api"
 
@@ -349,6 +356,10 @@
 
 // UpdateConfig updates and saves config
 func (c *Config) UpdateConfig(key string, value string, update bool) {
+	if nonEmptyConfigKeys[key] && value == "" {
+		fmt.Printf("Error: value for '%s' must not be empty\n", key)
+		return
+	}
 	switch key {
 	case "prompt":
 		c.Core.Prompt = value