Sha256: b3b58e4817b573346552230fa1078e691d6398ff098e57fff14e98bf8dbfffdd
Contents?: true
Size: 879 Bytes
Versions: 12
Compression:
Stored size: 879 Bytes
Contents
class User < CloudstackCli::Base desc 'list', 'list users' option :listall option :account option :format, default: "table", enum: %w(table json yaml) def list resolve_account users = client.list_users(options) if users.size < 1 say "No users found." else case options[:format].to_sym when :yaml puts({users: users}.to_yaml) when :json puts JSON.pretty_generate(users: users) else table = [["Account", "Type", "Name", "Email", "State", "Domain"]] users.each do |user| table << [ user['account'], Account::TYPES[user['accounttype']], "#{user['firstname']} #{user['lastname']}", user['email'], user['state'], user['domain'] ] end print_table table say "Total number of users: #{users.size}" end end end end
Version data entries
12 entries across 12 versions & 1 rubygems