Class: Gem::Commands::AgCommand

Inherits:
Gem::Command
  • Object
show all
Defined in:
lib/rubygems/commands/ag_command.rb

Instance Method Summary collapse

Constructor Details

#initializeAgCommand

Returns a new instance of AgCommand.



4
5
6
7
8
# File 'lib/rubygems/commands/ag_command.rb', line 4

def initialize
  super 'ag', "Search for PATTERN in installed gem source using 'ag'"

  add_ag_opts possible_ag_opts
end

Instance Method Details

#argumentsObject



10
11
12
# File 'lib/rubygems/commands/ag_command.rb', line 10

def arguments
  "PATTERN       Search Pattern"
end

#executeObject



18
19
20
21
22
23
24
25
# File 'lib/rubygems/commands/ag_command.rb', line 18

def execute
  search_term, gems_to_search = options[:args]
  gems_to_search = Array(gems_to_search).compact
  paths = search_paths(gems_to_search)
  flags = ag_flags

  execute_ag flags, search_term, paths
end

#usageObject



14
15
16
# File 'lib/rubygems/commands/ag_command.rb', line 14

def usage
  "#{program_name} PATTERN [GEMNAME ...]"
end