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.4.0.pre12 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre11 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre10 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre9 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre8 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre7 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre5 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre4 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre3 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.4.0.pre1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.4 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.3 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/stacks/registry/search_command.rb
kontena-cli-1.3.1 lib/kontena/cli/stacks/registry/search_command.rb