lib/cloudstack-cli/commands/environment.rb in cloudstack-cli-0.6.1 vs lib/cloudstack-cli/commands/environment.rb in cloudstack-cli-0.7.0
- old
+ new
@@ -72,21 +72,29 @@
else
say "Environment #{env} does not exist.", :red
end
end
- desc "default ENV", "set the default environment"
- def default(env)
+ desc "default [ENV]", "show or set the default environment"
+ def default(env = nil)
config = parse_config_file
+
+ unless env
+ default_env = config[:default] || '-'
+ say "The current default environment is \"#{default_env}\""
+ exit 0
+ end
+
if env == '-'
config.delete :default
else
unless config.has_key?(env)
say "Environment #{env} does not exist.", :red
exit 1
end
config[:default] = env
end
+
write_config_file(config)
say "Default environment set to #{env}."
end
no_commands do
\ No newline at end of file