Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ack
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ B<--flush> flushes output immediately. This is off by default
unless ack is running interactively (when output goes to a pipe or
file).

=item B<-f>
=item B<-f>, B<--files>

Only print the files that would be searched, without actually doing
any searching. PATTERN must not be specified, or it will be taken
Expand Down
3 changes: 2 additions & 1 deletion dev/generate-completion-scripts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'--count' => 'print a count of matching lines for each input file',
'--create-ackrc' => 'dumps default ack options to standard output',
'--dump' => 'writes the list of loaded options and where they came from',
'--files' => 'only print files that would be searched',
'--files-from' => 'specifies the list of files to search within FILE',
'--files-with-matches' => 'only print filenames of matching files',
'--files-without-matches' => 'only print filenames of non-matching files',
Expand Down Expand Up @@ -67,7 +68,6 @@
'--with-filename' => 'print the filename for each match',
'--word-regexp' => 'force PATTERN to match only whole words',
'-1' => 'stops after reporting first match',
'-f' => 'only print files that would be searched',
'-g' => 'only print files whose names match PATTERN',
'-o' => 'only print the part of each matching line that matches PATTERN',
'-s' => 'suppress error messages about nonexistent or unreadable files',
Expand All @@ -79,6 +79,7 @@
'--before-context' => ['-B'],
'--context' => ['-C'],
'--count' => ['-c'],
'--files' => ['-f'],
'--no-filename' => ['-h'],
'--with-filename' => ['-H'],
'--files-with-matches' => ['-l'],
Expand Down
2 changes: 1 addition & 1 deletion lib/App/Ack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Default switches may be specified in an .ackrc file. If you want no dependency
on the environment, turn it off with --noenv.

File select actions:
-f Only print the files selected, without
-f, --files Only print the files selected, without
searching. The PATTERN must not be specified.
-g Same as -f, but only select files matching
PATTERN.
Expand Down
2 changes: 1 addition & 1 deletion lib/App/Ack/ConfigLoader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ sub get_arg_spec {
$opt->{noenv_seen} = 1;
}
},
f => \$opt->{f},
'f|files' => \$opt->{f},
'files-from=s' => \$opt->{files_from},
'filter!' => \$App::Ack::is_filter_mode,
flush => sub { $| = 1 },
Expand Down
1 change: 1 addition & 0 deletions t/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ sub get_expected_options {
'--create-ackrc',
'--dump',
'--env',
'--files',
'--files-from',
'--files-with-matches',
'--files-without-matches',
Expand Down
13 changes: 12 additions & 1 deletion t/longopts.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This tests whether ack's command line options work as expected.

use Test::More;

plan tests => 52;
plan tests => 56;

use lib 't';
use Util;
Expand Down Expand Up @@ -136,6 +136,17 @@ for my $arg ( qw( -Q --literal ) ) {

my $expected = reslash( 't/swamp/options.pl' );

# Files
for my $arg ( qw( -f --files ) ) {
my @files = qw( t/swamp/options.pl );
my $results = run_ack( $arg, @files );
like(
$results,
qr{\Q$expected},
qq{$arg prints files that would be searched}
);
}

# Files with matches
for my $arg ( qw( -l --files-with-matches ) ) {
my @args = ( $arg, 'use strict' );
Expand Down