Sha256: b2b96b3cf3c464dfdc69e774951fe2424e5d25fdd3f29944d9c5491f82bf3588
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require "vmc/cli" module VMC class Space < CLI def precondition super fail "This command is v2-only." unless v2? end def self.by_name(what, obj = what) proc { |name, *_| client.send(:"#{obj}_by_name", name) || fail("Unknown #{what} '#{name}'") } end desc "Show space information" group :spaces input(:space, :argument => :optional, :from_given => by_name("space"), :desc => "Space to show") { client.current_space } input :full, :type => :boolean, :desc => "Show full information for apps, service instances, etc." def space(input) space = input[:space] line "name: #{c(space.name, :name)}" line "organization: #{c(space.organization.name, :name)}" if input[:full] line line "apps:" spaced(space.apps(2)) do |a| indented do invoke :app, :app => a end end else line "apps: #{name_list(space.apps)}" end if input[:full] line line "services:" spaced(space.service_instances(2)) do |i| indented do invoke :service, :instance => i end end else line "services: #{name_list(space.service_instances)}" end end private def name_list(xs) if xs.empty? c("none", :dim) else xs.collect { |x| c(x.name, :name) }.join(", ") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vmc-0.4.0.beta.25 | vmc-ng/lib/vmc/cli/space.rb |
vmc-0.4.0.beta.24 | vmc-ng/lib/vmc/cli/space.rb |