Class: MGit::GrepCommand
Instance Method Summary
collapse
Methods inherited from Command
create, #help, instance_each, list, register_alias, register_command
Instance Method Details
#description ⇒ Object
20
21
22
|
# File 'lib/mgit/commands/grep.rb', line 20
def description
'grep for a pattern in each repository'
end
|
#execute(args) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/mgit/commands/grep.rb', line 3
def execute(args)
raise TooFewArgumentsError.new(self) if args.size == 0
raise TooManyArgumentsError.new(self) if args.size > 1
ptrn = args[0]
Repository.chdir_each do |name, path|
puts "Looking for pattern '#{ptrn}' in repository #{name}...".yellow
puts `git grep #{ptrn}`
puts
end
end
|
#usage ⇒ Object
16
17
18
|
# File 'lib/mgit/commands/grep.rb', line 16
def usage
'grep <pattern>'
end
|