Sha256: 5e9b1c07c6c0b216fedfd67e834b9eefd1921fa073c21d7cfbeab5cbce43e2e8

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

#!/usr/bin/env ruby
require 'slop'

def opt_description(msgs)
  ind = ' ' * 22
  msgs.inject { |rtn, msg| rtn << "\n#{ind}#{msg}" }
end

opts = Slop.parse(help: true) do
  banner "Usage: gem-search gem_name [options]\n"
  on :s, :sort, opt_description([
      'Sort by name of item.',
      '  [n]ame (default)',
      '  [v]er  (displayed name: DL(ver))',
      '  [a]ll  (displayed name: DL(all))'
    ]), :argument => :optional
  on :v, :version, 'Display the version.'
end

OPT_SORT = {
  'v' => 'version_downloads',
  'a' => 'downloads',
}

exit if opts['h']

$:.unshift File.dirname(__FILE__) + '/../lib'
require 'gem-search'
if opts['v']
  puts "gem-search #{Gem::Search::VERSION}"
  exit
end

gs = Gem::Search::CLI.new
gs.search(ARGV[0], OPT_SORT[opts['sort']])

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem-search-0.0.2 bin/gem-search