class Kontena::Cli::Stacks::Registry::SearchCommand

Public Instance Methods

execute() click to toggle source
# File lib/kontena/cli/stacks/registry/search_command.rb, line 24
def execute
  results = stacks_client.search(query.to_s, tags: tag_list, include_prerelease: pre?, include_private: priv?)
  exit_with_error 'Nothing found' if results.empty?
  print_table(results.map { |r| r['attributes'] }) do |row|
    next if quiet?
    row['name'] = '%s/%s' % [row['organization-id'], row['name']]
    row['name'] = pastel.yellow(row['name']) if row['is-private']
    if row['latest-version'] && row['latest-version']['version']
      row['version'] = row['latest-version']['version']
      row['description'] = row['latest-version']['description']
    else
      row['version'] = '?'
    end

    row['description'] = '-' if row['description'].to_s.empty?
  end
end
fields() click to toggle source
# File lib/kontena/cli/stacks/registry/search_command.rb, line 20
def fields
  quiet? ? ['name'] : %w(name version pulls description)
end