lib/vmc/cli/organization/orgs.rb in vmc-0.4.7 vs lib/vmc/cli/organization/orgs.rb in vmc-0.5.0.beta.1

- old
+ new

@@ -2,34 +2,34 @@ module VMC::Organization class Orgs < Base desc "List available organizations" group :organizations - input :one_line, :alias => "-l", :type => :boolean, :default => false, - :desc => "Single-line tabular format" - input :full, :type => :boolean, :default => false, - :desc => "Show full information for apps, service instances, etc." + input :full, :desc => "Show full information for apps, services, etc.", + :default => false def orgs orgs = - with_progress("Getting organizations") do - client.organizations - end + with_progress("Getting organizations") do + client.organizations.sort_by(&:name) + end + return if orgs.empty? + line unless quiet? - if input[:one_line] - table( - %w{name spaces domains}, - orgs.collect { |o| - [ c(o.name, :name), - name_list(o.spaces), - name_list(o.domains) - ] - }) - else + if input[:full] orgs.each do |o| - invoke :org, :organization => o, :full => input[:full] + invoke :org, :organization => o, :full => true end + else + table( + %w{name spaces domains}, + orgs.collect { |o| + [ c(o.name, :name), + name_list(o.spaces), + name_list(o.domains) + ] + }) end end end -end \ No newline at end of file +end