class MGit::GrepCommand

Public Instance Methods

arity() click to toggle source
# File lib/mgit/commands/grep.rb, line 14
def arity
  [1, 1]
end
description() click to toggle source
# File lib/mgit/commands/grep.rb, line 22
def description
  'grep for a pattern in each repository'
end
execute(args) click to toggle source
# File lib/mgit/commands/grep.rb, line 5
def execute(args)
  ptrn = args[0]

  Registry.each do |repo|
    pinfo "Looking for pattern '#{ptrn}' in repository #{repo.name}..."
    System.git("grep '#{Shellwords.escape(ptrn)}'", chdir: repo.path, print_stdout: true)
  end
end
usage() click to toggle source
# File lib/mgit/commands/grep.rb, line 18
def usage
  'grep <pattern>'
end