Class: Ey::Core::Cli::EnvironmentVariables

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

Constant Summary collapse

MASK =
'****'.freeze
SYMBOLS_TO_DISPLAY =
4
MAX_LENGTH_TO_DISPLAY =
30

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



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ey-core/cli/environment_variables.rb', line 35

def handle
  environment_variables = if option(:application)
                            core_applications(option(:application)).flat_map(&:environment_variables)
                          elsif option(:environment)
                            core_environments(option(:environment)).flat_map(&:environment_variables)
                          else
                            core_environment_variables
                          end

  stream_print("ID" => 10, "Name" => 30, "Value" => 50, "Environment" => 30, "Application" => 30) do |printer|
    environment_variables.each_entry do |ev|
      printer.print(ev.id, ev.name, print_variable_value(ev), ev.environment_name, ev.application_name)
    end
  end
end