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.5.0.pre5 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.5.0.pre4 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.5.0.pre3 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.5.0.pre2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.5.0.pre1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.3 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.3.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.2.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.2.pre1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.1.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.1.pre1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.5 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.rc2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre14 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre13 lib/kontena/cli/stacks/registry/search_command.rb