lib/cloudstack-cli/commands/account.rb in cloudstack-cli-0.12.2 vs lib/cloudstack-cli/commands/account.rb in cloudstack-cli-0.12.3

- old
+ new

@@ -6,14 +6,15 @@ 2 => 'admin' } desc "show NAME", "show detailed infos about an account" def show(name) - unless account = client.list_accounts({name: name}) - puts "No account with name #{name} found." + accounts = client.list_accounts(name: name) + if accounts.size < 1 + say "No account named \"#{name}\" found.", :red else - account = account.first + account = accounts.first account.delete 'user' account['accounttype'] = "#{account['accounttype']} (#{TYPES[account['accounttype']]})" table = account.map do |key, value| [ set_color("#{key}", :yellow), "#{value}" ] end @@ -21,10 +22,10 @@ end end desc 'list [NAME]', 'list accounts (by name)' def list(name = nil) - accounts = client.list_accounts({name: name}) + accounts = client.list_accounts(name: name) if accounts.size < 1 puts "No accounts found." else table = [["Name", "Type", "Domain"]] accounts.each do |account|