describe helpful example oneliners
[git-grep-footer.git] / git-grep-footer
index b676ab8aef983e241ffb59921849d94075dd889d..6f20fac6f180c281612f0689b7f9b95b86813586 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,
@@ -218,6 +228,33 @@ Causes output to be buffered until all input has been read (obviously).
 
 =back
 
+=head1 EXAMPLES
+
+=over
+
+=item git-grep-footer --grep=^ack
+
+Search for Acked-by lines.
+Append C<-uin> to skip reoccurrences.
+
+=item git-grep-footer -u --grep=junio
+
+Show distinct lines mentioning a specific author.
+
+=item git-grep-footer -c --simplify --grep=^si
+
+Compare various capitalisations and (mis)spellings of signoffs.
+
+=item git-grep-footer -c --simplify=all -i | sort -n -r | head -n10
+
+List the ten most frequently used attribute names.
+
+=item git-grep-footer -n2 -i -s
+
+Upto two examples for each distinct identifier.
+
+=back
+
 =head1 AUTHOR
 
 Mischa POSLAWSKY <perl@shiar.org>