Sha256: dbb413a03522d100cdd4c2854a2ba4e0450bdd02c30e981c63172e53f1f002eb
Contents?: true
Size: 958 Bytes
Versions: 11
Compression:
Stored size: 958 Bytes
Contents
class User < CloudstackCli::Base desc 'list', 'list users' option :listall, type: :boolean, default: true 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 = [%w(Account Type Name Username Email State Domain)] users.each do |user| table << [ user['account'], Account::TYPES[user['accounttype']], "#{user['firstname']} #{user['lastname']}", user['username'], user['email'], user['state'], user['domain'] ] end print_table table say "Total number of users: #{users.size}" end end end end
Version data entries
11 entries across 11 versions & 1 rubygems