Sha256: 5d921221cc08d69013bd0ded10ed601e55933f1ec2c1e95451722c34dd1d31f0

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require "jdc/cli/organization/base"

module JDC::Organization
  class Org < Base
    desc "Show organization information"
    group :organizations
    input :organization, :desc => "Organization to show",
          :aliases => %w{--org -o}, :argument => :optional,
          :from_given => by_name(:organization),
          :default => proc { client.current_organization }
    input :full, :desc => "Show full information for spaces, domains, etc.",
          :default => false
    def org
      org = input[:organization]

      unless org
        return if quiet?
        fail "No current organization."
      end

      if quiet?
        puts org.name
        return
      end

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

      indented do
        line "domains: #{name_list(org.domains)}"

        if input[:full]
          line "spaces:"

          spaced(org.spaces(:depth => 2)) do |s|
            indented do
              invoke :space, :space => s
            end
          end
        else
          line "spaces: #{name_list(org.spaces)}"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
jdc-0.2.7 lib/jdc/cli/organization/org.rb
jdc-0.2.5 lib/jdc/cli/organization/org.rb
jdc-0.2.4 lib/jdc/cli/organization/org.rb
jdc-0.2.3 lib/jdc/cli/organization/org.rb
jdc-0.2.2 lib/jdc/cli/organization/org.rb
jdc-0.2.3.pre lib/jdc/cli/organization/org.rb
jdc-0.2.2.pre lib/jdc/cli/organization/org.rb
jdc-0.2.1.pre lib/jdc/cli/organization/org.rb
jdc-0.2.0 lib/jdc/cli/organization/org.rb