Sha256: 1fa36610ae5c230e1c32a9a769b3ac6f3c9c036cfcd1fd00b13fb05b465ac0ee
Contents?: true
Size: 933 Bytes
Versions: 1
Compression:
Stored size: 933 Bytes
Contents
module GemSearch module Commands class Run < Base ENABLE_SORT_OPTS = { 'v' => 'version_downloads', 'a' => 'downloads', 'n' => 'name', } def call unless valid?(options.arguments) puts options abort end executor = Executor.new gem = options.arguments[0] executor.search(gem, setup_opts) rescue GemSearch::LibraryNotFound => e puts e.message abort rescue => e puts "An unexpected #{e.class} has occurred." puts e.message puts e.backtrace if ENV['DEBUG'] abort end private def setup_opts { sort: ENABLE_SORT_OPTS[options['sort']] || 'downloads', detail: options.detail? } end def valid?(arguments) arguments.size > 0 && arguments.none? { |arg| arg.match(/\A-/) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gem-search-0.1.7 | lib/gem_search/commands/run.rb |