From fe8b3044b1f180f537b26ed3870e51f8f87e3480 Mon Sep 17 00:00:00 2001 From: Packy Anderson Date: Thu, 27 Mar 2014 17:52:10 -0400 Subject: [PATCH 1/4] Implement a -K|--no-known-types switch to turn off -k|--known-types. --- ConfigLoader.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ConfigLoader.pm b/ConfigLoader.pm index 34e9f4ff..c8125760 100644 --- a/ConfigLoader.pm +++ b/ConfigLoader.pm @@ -179,6 +179,10 @@ sub process_filetypes { push @{ $opt->{'filters'} }, @filters; }; + $additional_specs{'K|no-known-types'} = sub { + @{ $opt->{'filters'} } = (); + }; + return \%additional_specs; } From d20abd7d7f79ef0cce9edc46b2732c8204460f37 Mon Sep 17 00:00:00 2001 From: Packy Anderson Date: Tue, 15 Apr 2014 01:39:45 -0400 Subject: [PATCH 2/4] Add a test for --no-known-types|-K --- t/ack-no-known-types.t | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 t/ack-no-known-types.t diff --git a/t/ack-no-known-types.t b/t/ack-no-known-types.t new file mode 100644 index 00000000..56f83e5c --- /dev/null +++ b/t/ack-no-known-types.t @@ -0,0 +1,67 @@ +#!perl + +use strict; +use warnings; + +use File::Find; +use Test::More tests => 2; + +use lib 't'; +use Util; + +prep_environment(); + +my @files = split "\n", # using qw() produces the warning "Possible attempt to put comments in qw() list" +qq(t/swamp/0 +t/swamp/c-header.h +t/swamp/c-source.c +t/swamp/CMakeLists.txt +t/swamp/crystallography-weenies.f +t/swamp/example.R +t/swamp/file.bar +t/swamp/file.foo +t/swamp/fresh.css +t/swamp/groceries/another_subdir/fruit +t/swamp/groceries/another_subdir/junk +t/swamp/groceries/another_subdir/meat +t/swamp/groceries/fruit +t/swamp/groceries/junk +t/swamp/groceries/meat +t/swamp/groceries/subdir/fruit +t/swamp/groceries/subdir/junk +t/swamp/groceries/subdir/meat +t/swamp/html.htm +t/swamp/html.html +t/swamp/incomplete-last-line.txt +t/swamp/javascript.js +t/swamp/lua-shebang-test +t/swamp/Makefile +t/swamp/Makefile.PL +t/swamp/MasterPage.master +t/swamp/not-an-#emacs-workfile# +t/swamp/notaMakefile +t/swamp/notaRakefile +t/swamp/notes.md +t/swamp/options-crlf.pl +t/swamp/options.pl +t/swamp/parrot.pir +t/swamp/perl-test.t +t/swamp/perl-without-extension +t/swamp/perl.cgi +t/swamp/perl.handler.pod +t/swamp/perl.pl +t/swamp/perl.pm +t/swamp/perl.pod +t/swamp/pipe-stress-freaks.F +t/swamp/Rakefile +t/swamp/Sample.ascx +t/swamp/Sample.asmx +t/swamp/sample.asp +t/swamp/sample.aspx +t/swamp/sample.rake +t/swamp/service.svc +t/swamp/stuff.cmake); + +ack_sets_match( [ '--no-known-types', '-f', 't/swamp' ], \@files, '--no-known-types test' ); + +ack_sets_match( [ '-K', '-f', 't/swamp' ], \@files, '-K test' ); From 25416d63cb7c279ae07858435b2bbbc9db320341 Mon Sep 17 00:00:00 2001 From: Packy Anderson Date: Tue, 15 Apr 2014 01:44:23 -0400 Subject: [PATCH 3/4] Update the documention to reflect the addition of -K|--no-known-types. --- Ack.pm | 1 + ack | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Ack.pm b/Ack.pm index eb4f0a26..8e6d888c 100644 --- a/Ack.pm +++ b/Ack.pm @@ -341,6 +341,7 @@ File inclusion/exclusion: -n, --no-recurse No descending into subdirectories --[no]follow Follow symlinks. Default is off. -k, --known-types Include only files of types that ack recognizes. + -K, --no-known-types Include all files types. --type=X Include only X files, where X is a recognized filetype. diff --git a/ack b/ack index 38ba8114..6301fe26 100644 --- a/ack +++ b/ack @@ -1301,6 +1301,12 @@ identically to file type filters as seen in L. Limit selected files to those with types that ack knows about. This is equivalent to the default behavior found in ack 1. +=item B<-K>, B<--no-known-types> + +Do not limit selected files to those with types that ack knows about. This is +the default behavior found in ack 2, but this allows you to override an earlier +specification of -k or --known-types + =item B<--lines=I> Only print line I of each file. Multiple lines can be given with multiple From 6b7d02d4da601fddfb9297ba63f8ac8d84545eec Mon Sep 17 00:00:00 2001 From: Packy Anderson Date: Mon, 26 Oct 2015 14:51:18 -0400 Subject: [PATCH 4/4] Add MatchGroup.t to test plan. --- t/lib/MatchGroup.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 t/lib/MatchGroup.t diff --git a/t/lib/MatchGroup.t b/t/lib/MatchGroup.t new file mode 100644 index 00000000..cad1e764 --- /dev/null +++ b/t/lib/MatchGroup.t @@ -0,0 +1,12 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More tests => 1; + +use App::Ack::Filter::MatchGroup; + +pass( 'App::Ack::Filter::MatchGroup loaded with nothing else loaded first' ); + +done_testing();