Class: Central::Cli::Master::ListCommand
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- Central::Cli::Master::ListCommand
- Includes:
- Common
- Defined in:
- lib/central/cli/master/list_command.rb
Instance Method Summary collapse
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
#execute ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/central/cli/master/list_command.rb', line 7 def execute header = %w(Name Url) rows = [] current_server = settings['current_server'] settings['servers'].each do |server| name = if server['name'] == current_server "* #{server['name']}" else server['name'] end rows << [name, server['url']] end ttable = TTY::Table.new header: header, rows: Array.new(rows) renderer = TTY::Table::Renderer::Unicode.new(ttable) renderer.border.style = :cyan renderer.padding = [0, 1, 0, 1] puts renderer.render end |