Class: Ki::VersionSearch

Inherits:
Object show all
Defined in:
lib/cmd/version_cmd.rb

Overview

Sets status for version

Instance Method Summary collapse

Instance Method Details

#execute(ctx, args) ⇒ Object



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/cmd/version_cmd.rb', line 440

def execute(ctx, args)
  finder = ctx.ki_home.finder
  args.each do |arg|
    version = finder.version(arg)
    if version
      puts version.version_id
    else
      matcher = FileRegexp.matcher(arg)
      found_components = finder.components.keys.select { |name| matcher.match(name) }
      if found_components.size > 0
        puts "Found components(#{found_components.size}):"
        puts found_components.join("\n")
      else
        puts "'#{arg}' does not match versions or components"
      end
    end
  end
end

#helpObject



463
464
465
466
467
468
469
470
471
472
# File 'lib/cmd/version_cmd.rb', line 463

def help
<<EOF
"#{shell_command}" searches for versions and components.

### Examples

#{shell_command} my/component
#{shell_command} my/*
EOF
end

#summaryObject



459
460
461
# File 'lib/cmd/version_cmd.rb', line 459

def summary
  "Searches for versions and components"
end