Module: NexClient::Commands::Organizations
- Extended by:
- Helpers
- Defined in:
- lib/nex_client/commands/organizations.rb
Constant Summary collapse
- ORGS_TITLE =
"Organizations".colorize(:green)
- ORGS_HEADERS =
['id','name','handle'].map(&:upcase)
Constants included from Helpers
Helpers::LOG_COLORS, Helpers::VARS_HEADERS, Helpers::VARS_TITLE
Class Method Summary collapse
Methods included from Helpers
display_events, display_logs, display_raw_vars, display_record_errors, display_vars, display_yaml_vars, error, events, format_cmd, hash_from_file, perform_ssh_cmd, success, vars_from_file, vars_from_plain_file, vars_from_yaml_file, with_cert_identity
Class Method Details
.display_organizations(list) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/nex_client/commands/organizations.rb', line 23 def self.display_organizations(list) table = Terminal::Table.new title: ORGS_TITLE, headings: ORGS_HEADERS do |t| [list].flatten.compact.each do |e| t.add_row([e.id,e.name,e.handle]) end end puts table puts "\n" end |
.list(args, opts) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nex_client/commands/organizations.rb', line 10 def self.list(args,opts) # Display list list = NexClient::Organization.order('handle') self.display_organizations(list) # Loop through results while (list.pages.links||{})['next'] return true if ask("Press enter for next page ('q' to quit)") =~ /q/ list = list.pages.next self.display_organizations(list) end end |