Class: Dreamy::Command::Users

Inherits:
Base
  • Object
show all
Defined in:
lib/dreamy/commands/users.rb

Instance Attribute Summary

Attributes inherited from Base

#args

Instance Method Summary collapse

Methods inherited from Base

#ask, #display, #extract_option, #home_directory, #initialize, #running_on_windows?, #shell

Constructor Details

This class inherits a constructor from Dreamy::Command::Base

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dreamy/commands/users.rb', line 4

def index
  users = @account.users
  if users.empty?
    display "No users on this account"
  else
    user_table = table do |t|
      t.headings = 'Name', 'Account Type', 'Server', 'Disk used (MB)', 'Quota (MB)'
      users.each { |u| t << [u.gecos, u.type, u.home, u.disk_used_mb, u.quota_mb]  }
    end
    display user_table
  end
end

#pwObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dreamy/commands/users.rb', line 17

def pw
  users = @account.users(passwords=true)
  if users.empty?
    display "No users on this account"
  else
    user_table = table do |t|
      t.headings = 'UserName', 'Password'
      users.each { |u| t << [u.username, u.password]  }
    end
    display user_table
    
  end
end