2011-01-18 19:08:49 -05:00
|
|
|
######################################################################
|
|
|
|
# This file is imported from the rubygems project.
|
|
|
|
# DO NOT make modifications in this repo. They _will_ be reverted!
|
|
|
|
# File a patch instead and assign it to Ryan Davis or Eric Hodel.
|
|
|
|
######################################################################
|
|
|
|
|
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
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super 'list', 'Display gems whose name starts with STRING'
|
|
|
|
|
|
|
|
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
|
|
|
|
string = get_one_optional_argument || ''
|
|
|
|
options[:name] = /^#{string}/i
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
2008-06-17 18:04:18 -04:00
|
|
|
|