Menu

#20 csearch: Add flag (-g) for grouping output by file (a'la ack --group, or git grep --heading) [PATCH]

New
nobody
None
Medium
Defect
2012-04-23
2012-04-19
Anonymous
No

Originally created by: ayieh...@gmail.com

The goal is so that the output is more palatable to the human eyes, compare:

$ csearch Aqyadaya
/home/nazri/perl5/perlbrew/perls/perl-5.14.2/man/man3/Text::SimpleTable.3:\&    $t1\->row(\*(Aqfoobarbaz\*(Aq, \*(Aqyadayadayada\*(Aq);
/home/nazri/perl5/perlbrew/perls/perl-5.14.2/man/man3/Text::SimpleTable.3:\&    $t2\->row(\*(Aqfoobarbaz\*(Aq, \*(Aqyadayadayada\*(Aq);
/home/nazri/perl5/perlbrew/perls/perl-5.14.2/man/man3/Text::SimpleTable.3:\&    $t3\->row(\*(Aqfoobarbaz\*(Aq, \*(Aqyadayadayada\*(Aq);

$ csearch -g Aqyadaya
/home/nazri/perl5/perlbrew/perls/perl-5.14.2/man/man3/Text::SimpleTable.3
\&    $t1\->row(\*(Aqfoobarbaz\*(Aq, \*(Aqyadayadayada\*(Aq);
\&    $t2\->row(\*(Aqfoobarbaz\*(Aq, \*(Aqyadayadayada\*(Aq);
\&    $t3\->row(\*(Aqfoobarbaz\*(Aq, \*(Aqyadayadayada\*(Aq);

1 Attachments

Discussion

  • Anonymous

    Anonymous - 2012-04-19

    Originally posted by: ayieh...@gmail.com

    The patch is buggy :) - in some cases it shows the filename even when there's no match. Attached patch should fix this.

     
  • Anonymous

    Anonymous - 2012-04-20

    Originally posted by: dgryski

    This looks great!  Russ Cox should be releasing a new version soon -- hopefully your patch will make it in.

     
  • Anonymous

    Anonymous - 2012-04-23

    Originally posted by: ayieh...@gmail.com

    The patch blindly adds an empty line after the matches. I'm not sure if others are ok with this behavior. Me I prefer the empty line as it shows the grouping better.

     
  • Anonymous

    Anonymous - 2012-04-23

    Originally posted by: dgryski

    Seeing as you're already changing the output format based on a flag, I don't think the extra blank line is necessarily a problem.   If this behaviour matches what ack and grep do, then it's probably fine: we're at least matching what other similar tools emit.

     

Log in to post a comment.

MongoDB Logo MongoDB