Sha256: 5f3459ae6d7a4a0f438ebe9fa469c51be5d0549bd036d9fce353134280ea04d6

Contents?: true

Size: 1.09 KB

Versions: 30

Compression:

Stored size: 1.09 KB

Contents

require 'ey-core/cli/subcommand'
require 'ey-core/cli/helpers/stream_printer'

module Ey
  module Core
    module Cli
      class Environments < Subcommand
        include Ey::Core::Cli::Helpers::StreamPrinter
        title "environments"
        summary "Retrieve a list of Engine Yard environments that you have access to."

        option :account,
          short: 'c',
          long: 'account',
          description: 'Filter by account name or id',
          argument: 'Account'

        def handle
          if option(:account)
            stream_print("ID" => 10, "Name" => 50) do |printer|
              core_account.environments.each_entry do |env|
                printer.print(env.id, env.name)
              end
            end
          else
            stream_print("ID" => 10, "Name" => 50, "Account" => 50) do |printer|
              core_accounts.each_entry do |account|
                account.environments.each_entry do |env|
                  printer.print(env.id, env.name, account.name)
                end
              end
            end
          end
        end

      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
ey-core-3.2.0 lib/ey-core/cli/environments.rb
ey-core-3.1.11 lib/ey-core/cli/environments.rb
ey-core-3.1.10 lib/ey-core/cli/environments.rb
ey-core-3.1.9 lib/ey-core/cli/environments.rb
ey-core-3.1.8 lib/ey-core/cli/environments.rb
ey-core-3.1.7 lib/ey-core/cli/environments.rb
ey-core-3.1.6 lib/ey-core/cli/environments.rb
ey-core-3.1.5 lib/ey-core/cli/environments.rb
ey-core-3.1.4 lib/ey-core/cli/environments.rb
ey-core-3.1.3 lib/ey-core/cli/environments.rb