1require 'rubygems/command' 2require 'rubygems/commands/query_command' 3 4class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand 5 6 def initialize 7 super 'search', 'Display all gems whose name contains STRING' 8 9 remove_option '--name-matches' 10 11 defaults[:domain] = :remote 12 end 13 14 def arguments # :nodoc: 15 "STRING fragment of gem name to search for" 16 end 17 18 def defaults_str # :nodoc: 19 "--remote --no-details" 20 end 21 22 def usage # :nodoc: 23 "#{program_name} [STRING]" 24 end 25 26 def execute 27 string = get_one_optional_argument 28 options[:name] = /#{string}/i 29 super 30 end 31 32end 33 34