Sha256: 4a6298d04a70230a920144bb29b36d74d7ae5e5bb40b30abf1cf9314b481e1c7

Contents?: true

Size: 846 Bytes

Versions: 48

Compression:

Stored size: 846 Bytes

Contents

require_relative '../common'

module Kontena::Cli::Stacks::Registry
  class SearchCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::Stacks::Common

    banner "Search for stacks on the stack registry"

    parameter "[QUERY]", "Query string"

    option ['-q', '--quiet'], :flag, "Output the identifying column only"

    def execute
      results = stacks_client.search(query.to_s)
      if quiet?
        puts results.map { |s| s['stack'] }.join("\n")
        exit 0
      end
      exit_with_error 'Nothing found' if results.empty?
      titles = ['NAME', 'VERSION', 'DESCRIPTION']
      columns = "%-40s %-10s %-40s"
      puts columns % titles
      results.each do |stack|
        puts columns % [stack['stack'], stack['version'] || '?', stack['description'] || '-'] if stack
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
kontena-cli-1.3.1.rc2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.0 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.0.rc4 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.0.rc3 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.0.rc2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.0.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.0.pre2 lib/kontena/cli/stacks/registry/search_command.rb