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

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

Instance Attribute Summary

Attributes inherited from Kontena::Command

#arguments, #exit_code, #result

Instance Method Summary collapse

Methods included from Common

#short_name

Methods inherited from Kontena::Command

banner, callback_matcher, #help_requested?, inherited, 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

#execute ⇒ Object



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

def execute
  results = Kontena::PluginManager.instance.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 = Kontena::PluginManager.instance.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