Method: Git::Lib#grep
- Defined in:
- lib/git/lib.rb
#grep(string, opts = {})
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
returns hash [tree-ish] = [[line_no, match], [line_no, match2]] [tree-ish] = [[line_no, match], [line_no, match2]]
815 816 817 818 819 820 821 822 823 824 825 826 827 828 |
# File 'lib/git/lib.rb', line 815 def grep(string, opts = {}) opts[:object] ||= 'HEAD' ArgsBuilder.validate!(opts, GREP_OPTION_MAP) boolean_flags = build_args(opts, GREP_OPTION_MAP) args = ['-n', *boolean_flags, '-e', string, opts[:object]] if (limiter = opts[:path_limiter]) args.push('--', *Array(limiter)) end lines = execute_grep_command(args) parse_grep_output(lines) end |