Class: Ey::Core::Cli::Environments

Inherits:
Subcommand
  • Object
show all
Includes:
Helpers::StreamPrinter
Defined in:
lib/ey-core/cli/environments.rb

Instance Method Summary collapse

Methods included from Helpers::StreamPrinter

#stream_print

Methods inherited from Subcommand

#handle_core_error, #run_handle, #setup

Methods included from Helpers::Core

#core_account, #core_accounts, #core_application_for, #core_applications, #core_client, #core_environment_for, #core_environment_variables, #core_environments, #core_operator_and_environment_for, #core_server_for, #core_url, #core_yaml, #eyrc_yaml, included, #longest_length_by_name, #operator, #unauthenticated_core_client, #write_core_yaml

Instance Method Details

#handleObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ey-core/cli/environments.rb', line 18

def handle
  if option(:account)
    stream_print("ID" => 10, "Name" => 50) do |printer|
      .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 ||
        .environments.each_entry do |env|
          printer.print(env.id, env.name, .name)
        end
      end
    end
  end
end