Sha256: 2cf2779d64ab4f323a7f1b1acddf51d08d6bf99aa8804c1e9e7b3c62f6aafeee

Contents?: true

Size: 1.56 KB

Versions: 67

Compression:

Stored size: 1.56 KB

Contents

require "cf/cli/start/base"

module CF::Start
  class Info < Base
    def precondition
      check_target
    end

    desc "Display information on the current target, user, etc."
    group :start
    input :services, :desc => "List supported services", :alias => "-s",
          :default => false
    input :all, :desc => "Show all information", :alias => "-a",
          :default => false
    def info
      all = input[:all]

      if all || input[:services]
        services = with_progress("Getting services") { client.services }
      end

      if all || !services
        info = client.info

        line if services
        line info[:description]
        line
        line "target: #{b(client.target)}"

        indented do
          line "version: #{info[:version]}"
          line "support: #{info[:support]}"
        end

        if (user = client.current_user)
          line
          line "user: #{b(user.email || user.guid)}"
        end
      end

      if services
        line unless quiet?

        if services.empty? && !quiet?
          line "#{d("none")}"
        elsif input[:quiet]
          services.each do |s|
            line s.label
          end
        else
          table(
              ["service", "version", "provider", "plans", "description"],
              services.sort_by(&:label).collect { |s|
                [c(s.label, :name),
                 s.version,
                 s.provider,
                 s.service_plans.collect(&:name).join(", "),
                 s.description
                ]
              })
        end
      end
    end
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
cf-4.0.0rc2 lib/cf/cli/start/info.rb
cf-4.0.0rc1 lib/cf/cli/start/info.rb
cf-3.1.0rc2 lib/cf/cli/start/info.rb
cf-3.1.0.rc1 lib/cf/cli/start/info.rb
cf-3.0.1.rc1 lib/cf/cli/start/info.rb
cf-3.0.0 lib/cf/cli/start/info.rb
cf-3.0.0rc3 lib/cf/cli/start/info.rb
cf-3.0.0rc2 lib/cf/cli/start/info.rb
cf-3.0.0rc1 lib/cf/cli/start/info.rb
cf-2.1.0 lib/cf/cli/start/info.rb
cf-2.0.1 lib/cf/cli/start/info.rb
cf-2.0.0 lib/cf/cli/start/info.rb
cf-1.1.4 lib/cf/cli/start/info.rb
cf-1.1.3.rc1 lib/cf/cli/start/info.rb
cf-1.1.2 lib/cf/cli/start/info.rb
cf-1.1.2.rc2 lib/cf/cli/start/info.rb
cf-1.1.2.rc1 lib/cf/cli/start/info.rb
cf-1.1.1 lib/cf/cli/start/info.rb
cf-1.1.0 lib/cf/cli/start/info.rb
cf-1.0.1.rc1 lib/cf/cli/start/info.rb