diff --git a/config/config.go b/config/config.go index 91632aa..483a478 100644 --- a/config/config.go +++ b/config/config.go @@ -45,6 +45,13 @@ const ( 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" @@ -347,6 +354,10 @@ func (c *Config) LoadProfile(name string) { // 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