2007-11-10 02:48:56 -05:00
|
|
|
require 'rubygems/command'
|
|
|
|
require 'rubygems/commands/query_command'
|
|
|
|
|
2008-06-17 18:04:18 -04:00
|
|
|
##
|
|
|
|
# An alternate to Gem::Commands::QueryCommand that searches for gems starting
|
|
|
|
# with the the supplied argument.
|
|
|
|
|
|
|
|
class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
|
|
|
|
|
2012-11-29 01:52:18 -05:00
|
|
|
def initialize(name = 'list',
|
|
|
|
summary = 'Display gems whose name starts with STRING')
|
|
|
|
super name, summary
|
2008-06-17 18:04:18 -04:00
|
|
|
|
|
|
|
remove_option('--name-matches')
|
|
|
|
end
|
|
|
|
|
|
|
|
def arguments # :nodoc:
|
|
|
|
"STRING start of gem name to look for"
|
|
|
|
end
|
|
|
|
|
|
|
|
def defaults_str # :nodoc:
|
|
|
|
"--local --no-details"
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
2008-06-17 18:04:18 -04:00
|
|
|
|
|
|
|
def usage # :nodoc:
|
|
|
|
"#{program_name} [STRING]"
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2012-11-29 01:52:18 -05:00
|
|
|
name = get_one_optional_argument || ''
|
|
|
|
options[:name] = /^#{name}/i
|
|
|
|
|
2008-06-17 18:04:18 -04:00
|
|
|
super
|
|
|
|
end
|
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
2008-06-17 18:04:18 -04:00
|
|
|
|