Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ack CPAN distribution.

Maintainer(s)' notes

ack's issues are tracked at https://github.com/petdance/ack2

Report information
The Basics
Id: 24536
Status: resolved
Priority: 0/
Queue: ack

People
Owner: Nobody in particular
Requestors: grantm [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Patch to add --skip-dir option
The attached patch implements a --skip-dir option which can be used multiple times on the command line and adds directory names to the list of ones to be skipped. My motivation for this option is that my working directories often include directories used for building packaged versions of a project - similar in concept to Perl's blib directory. For example I use deb_build for building Debian packages. If the feature meets with your approval, I'm happy to implement regression tests - although I'd appreciate a pointer as to where to add them. Cheers Grant
Subject: ack-skip-dir.patch
Index: ack =================================================================== --- ack (revision 269) +++ ack (working copy) @@ -73,6 +73,7 @@ 'help|?:s' => sub { shift; App::Ack::show_help(@_); exit; }, 'help-types'=> sub { App::Ack::show_help_types(); exit; }, 'man' => sub {require Pod::Usage; Pod::Usage::pod2usage({-verbose => 2}); exit}, + 'skip-dir=s'=> sub { shift; App::Ack::add_skipdir( @_ ); }, 'type=s' => sub { # Whatever --type=xxx they specify, set it manually in the hash Index: Ack.pm =================================================================== --- Ack.pm (revision 269) +++ Ack.pm (working copy) @@ -84,6 +84,18 @@ =head1 FUNCTIONS +=head2 add_skipdir( $dirname ) + +Add a directory name to the list of ones to skip. + +=cut + +sub add_skipdir { + my($dir_name) = @_; + push @ignore_dirs, $dir_name; + $ignore_dirs{$dir_name} = 1; +} + =head2 skipdir_filter Standard filter to pass as a L<File::Next> descend_filter. It