Class: Kontena::Cli::Plugins::SearchCommand

Inherits:
Kontena::Command show all
Includes:
Common, PluginManager::Common
Defined in:
lib/kontena/cli/plugins/search_command.rb

Constant Summary

Constants included from PluginManager::Common

PluginManager::Common::KRATES_PLUGIN

Instance Attribute Summary

Attributes inherited from Kontena::Command

#arguments, #exit_code, #result

Instance Method Summary collapse

Methods included from PluginManager::Common

dummy_ui, gem_versions, install_dir, installed, installed?, plugin_debug?, plugins, prefix, rubygems_client, search_plugins, use_dummy_ui

Methods included from Common

#short_name

Methods inherited from Kontena::Command

banner, callback_matcher, #help_requested?, inherited, #instance, load_subcommand, requires_current_account_token, requires_current_account_token?, requires_current_grid, requires_current_grid?, requires_current_master, requires_current_master?, requires_current_master_token, requires_current_master_token?, #run, #run_callbacks, #verify_current_account_token, #verify_current_grid, #verify_current_master, #verify_current_master_token

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kontena/cli/plugins/search_command.rb', line 12

def execute
  results = search_plugins(name)
  exit_with_error("Cannot access plugin server") unless results
  puts "%-50s %-10s %-60s" % ['NAME', 'VERSION', 'DESCRIPTION']
  results.each do |item|
    if pre?
      latest = rubygems_client.latest_version(item['name'], pre: true)
      item['version'] = latest.version.to_s
    end
    puts "%-50s %-10s %-60s" % [short_name(item['name']), item['version'], item['info']]
  end
end