Class: Central::Cli::Stacks::CurrentCommand

Inherits:
Clamp::Command
  • Object
show all
Includes:
Common, Common
Defined in:
lib/central/cli/stacks/current_command.rb

Instance Method Summary collapse

Methods included from Common

#calculate_filesystem_stats, #calculate_loads, #calculate_mem_used, #find_stack_by_name, #print_stack, #stacks, #to_gigabytes

Methods included from Common

#access_token=, #add_master, #api_url, #api_url=, #clear_current_stack, #client, #current_master, #current_master=, #current_master_index, #current_stack, #current_stack=, #ensure_custom_ssl_ca, #require_api_url, #require_current_stack, #require_token, #reset_client, #save_settings, #settings, #settings_filename

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/central/cli/stacks/current_command.rb', line 10

def execute
  require_api_url
  if current_stack.nil?
    abort 'No stack selected. To select stack, please run: cm stack use <stack name>'
  else

    stack = client(require_token).get("stacks/#{current_stack}")
    if name?
      puts (stack['name']).to_s
    else
      print_stack(stack)
    end
  end
end