grep option
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 5 Feb 2011 02:16:24 +0000 (03:16 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 5 Feb 2011 02:16:24 +0000 (03:16 +0100)
git-grep-footer

index b676ab8aef983e241ffb59921849d94075dd889d..c5d94400521c8bf56c06938762734ee68c8a28fd 100755 (executable)
@@ -13,6 +13,7 @@ GetOptions(\my %opt,
        'simplify|s:s',
        'ignore-case|i!',
        'fuzzy!',
+       'grep|S=s',
        'min|min-count|unique|u:i',
        'max|max-count|show|n:i',
        'version|V'  => sub { Getopt::Long::VersionMessage() },
@@ -75,6 +76,10 @@ while (readline) {
                                }
                        }
 
+                       if (defined $opt{grep}) {
+                               $_ ~~ qr/$opt{grep}/i or next LINE;
+                       }
+
                        given ($opt{simplify} // 'none') {
                                when (['email', 'authors']) {
                                        $header[1] =~ s{
@@ -200,6 +205,11 @@ Values will be hidden entirely, so only attribute names remain.
 
 =back
 
+=item --grep=<pattern>
+
+Only include lines matching the specified regular expression.
+Case insensitivity can be disabled by prepending C<(?-i)>.
+
 =item -u, --unique[=<threshold>]
 
 Each match is only shown once,