Sha256: 57ab33bff79e52f27b83ecc46ebab868cd81be64ba2246e90edb5a40b088a3f8

Contents?: true

Size: 1.58 KB

Versions: 24

Compression:

Stored size: 1.58 KB

Contents

require "vmc/cli/space/base"

module VMC::Space
  class Space < Base
    desc "Show space information"
    group :spaces
    input :organization, :desc => "Space's organization",
          :aliases => %w{--org -o},
          :default => proc { client.current_organization },
          :from_given => by_name(:organization)
    input :space, :desc => "Space to show", :argument => :optional,
          :default => proc { client.current_space },
          :from_given => space_by_name
    input :full, :desc => "Show full information for apps, services, etc.",
          :default => false
    def space
      org = input[:organization]
      space = input[:space, org]

      unless space
        return if quiet?
        fail "No current space."
      end

      if quiet?
        puts space.name
        return
      end

      line "#{c(space.name, :name)}:"

      indented do
        line "organization: #{c(space.organization.name, :name)}"

        if input[:full]
          line
          line "apps:"

          spaced(space.apps(:depth => 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(:depth => 2)) do |s|
            indented do
              invoke :service, :service => s
            end
          end
        else
          line "services: #{name_list(space.service_instances)}"
        end

        line "domains: #{name_list(space.domains)}"
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
vmc-0.5.1 lib/vmc/cli/space/space.rb
static-1.0.3 vendor/vmc-0.5.0/lib/vmc/cli/space/space.rb
vmc-0.5.1.rc6 lib/vmc/cli/space/space.rb
static-1.0.1 vendor/vmc-0.5.0/lib/vmc/cli/space/space.rb
vmc-0.5.1.rc5 lib/vmc/cli/space/space.rb
vmc-0.5.1.rc4 lib/vmc/cli/space/space.rb
vmc-0.5.1.rc3 lib/vmc/cli/space/space.rb
vmc-0.5.1.rc2 lib/vmc/cli/space/space.rb
vmc-0.5.1.rc1 lib/vmc/cli/space/space.rb
vmc-0.5.0 lib/vmc/cli/space/space.rb
vmc-0.5.0.rc4 lib/vmc/cli/space/space.rb
vmc-0.5.0.rc3 lib/vmc/cli/space/space.rb
vmc-0.5.0.rc2 lib/vmc/cli/space/space.rb
vmc-0.5.0.rc1 lib/vmc/cli/space/space.rb
vmc-0.5.0.beta.12 lib/vmc/cli/space/space.rb
vmc-0.5.0.beta.11 lib/vmc/cli/space/space.rb
vmc-0.5.0.beta.10 lib/vmc/cli/space/space.rb
vmc-0.5.0.beta.7 lib/vmc/cli/space/space.rb
vmc-0.5.0.beta.6 lib/vmc/cli/space/space.rb
vmc-0.5.0.beta.5 lib/vmc/cli/space/space.rb