| 1 | #!/usr/local/bin/perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 579 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 579 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 579 | our $VERSION = 'v3.10.0'; # Check https://beyondgrep.com/ for updates | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 579 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 579 | ▶ | no re 'eval'; # Enforce default and block -Mre=eval to block RCE security problem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 579 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 579 | ▶ | use File::Next (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 579 | ▶ | use Getopt::Long (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 579 | ▶ | use App::Ack (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 579 | ▶ | use App::Ack::ConfigLoader (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 579 | ▶ | use App::Ack::File (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 579 | ▶ | use App::Ack::Files (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 579 | ▶ | use App::Ack::Filter (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 579 | ▶ | use App::Ack::Filter::Default (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 579 | ▶ | use App::Ack::Filter::Extension (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 579 | ▶ | use App::Ack::Filter::FirstLineMatch (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 579 | ▶ | use App::Ack::Filter::Inverse (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 579 | ▶ | use App::Ack::Filter::Is (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 579 | ▶ | use App::Ack::Filter::IsPath (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 579 | ▶ | use App::Ack::Filter::Match (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 579 | ▶ | use App::Ack::Filter::Collection (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # Global command-line options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 579 | our $opt_1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 579 | our $opt_A; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 579 | our $opt_B; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 579 | our $opt_break; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 579 | our $opt_color; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 579 | our $opt_column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 579 | our $opt_debug; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 579 | our $opt_c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 579 | our $opt_f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 579 | our $opt_g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 579 | our $opt_heading; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 579 | our $opt_L; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 579 | our $opt_l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 579 | our $opt_m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 579 | our $opt_output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 579 | our $opt_passthru; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 579 | our $opt_p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 579 | our $opt_range_start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 579 | our $opt_range_end; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 579 | our $opt_regex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 579 | our $opt_show_filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 579 | our $opt_show_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 579 | our $opt_underline; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 579 | our $opt_v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # Flag if we need any context tracking. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 579 | our $is_tracking_context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # The regex that we use to match each line in the file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 579 | our $re_match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # Regex for matching for highlighting in matched lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 579 | our $re_hilite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # The regex that matches for things we want to exclude via the --not option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 579 | our $re_not; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # Version of the match regex for checking to see if the file should be scanned line-by-line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 579 | our $re_scan; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 579 | our @special_vars_used_by_opt_output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 579 | our $using_ranges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # Internal stats for debugging. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 579 | our %stats; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | MAIN: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 579 | $App::Ack::ORIGINAL_PROGRAM_NAME = $0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 579 | $0 = join(' ', 'ack', $0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 579 | $App::Ack::ors = "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 579 | ▶ | if ( $App::Ack::VERSION ne $main::VERSION ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | App::Ack::die( "Program/library version mismatch\n\t$0 is $main::VERSION\n\t$INC{'App/Ack.pm'} is $App::Ack::VERSION" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # Do preliminary arg checking; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 579 | my $env_is_usable = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 579 | for my $arg ( @ARGV ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 3125 | ▶ | last if ( $arg eq '--' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # Get the --thpppt, --bar, --cathy and --man checking out of the way. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3095 | ▶ | $arg =~ /^--th[pt]+t+$/ and App::Ack::thpppt($arg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 3094 | ▶ | $arg eq '--bar' and App::Ack::ackbar(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 3093 | ▶ | $arg eq '--cathy' and App::Ack::cathy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # See if we want to ignore the environment. (Don't tell Al Gore.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 3092 | ▶ | $arg eq '--env' and $env_is_usable = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 3092 | ▶ | $arg eq '--noenv' and $env_is_usable = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 576 | ▶ | if ( $env_is_usable ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 18 | ▶ | if ( $ENV{ACK_OPTIONS} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | App::Ack::warn( 'WARNING: ack no longer uses the ACK_OPTIONS environment variable. Use an ackrc file instead.' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 558 | my @keys = ( 'ACKRC', grep { /^ACK_/ } keys %ENV ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 558 | delete @ENV{@keys}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # Load colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 576 | ▶ | my $modules_loaded_ok = eval 'use Term::ANSIColor 1.10 (); 1;'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 576 | ▶ | if ( $modules_loaded_ok && $App::Ack::is_windows ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$modules_loaded_ok and $App::Ack::is_windows
MC/DC0%0/2
$modules_loaded_ok and $App::Ack::is_windows
$modules_loaded_ok
$App::Ack::is_windows
Truth table33%1/3
A and B
A= $modules_loaded_okB= $App::Ack::is_windows
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $modules_loaded_ok = eval 'use Win32::Console::ANSI; 1;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 576 | ▶ | if ( $modules_loaded_ok ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 576 | ▶ | $ENV{ACK_COLOR_MATCH} ||= 'black on_yellow'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{"ACK_COLOR_MATCH"} ||= "black on_yellow"
MC/DC0%0/1
$ENV{"ACK_COLOR_MATCH"} ||= "black on_yellow"
$ENV{"ACK_COLOR_MATCH"}
Truth table50%1/2
A
A= $ENV{"ACK_COLOR_MATCH"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 576 | ▶ | $ENV{ACK_COLOR_FILENAME} ||= 'bold green'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{"ACK_COLOR_FILENAME"} ||= "bold green"
MC/DC0%0/1
$ENV{"ACK_COLOR_FILENAME"} ||= "bold green"
$ENV{"ACK_COLOR_FILENAME"}
Truth table50%1/2
A
A= $ENV{"ACK_COLOR_FILENAME"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 576 | ▶ | $ENV{ACK_COLOR_LINENO} ||= 'bold yellow'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{"ACK_COLOR_LINENO"} ||= "bold yellow"
MC/DC0%0/1
$ENV{"ACK_COLOR_LINENO"} ||= "bold yellow"
$ENV{"ACK_COLOR_LINENO"}
Truth table50%1/2
A
A= $ENV{"ACK_COLOR_LINENO"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 576 | ▶ | $ENV{ACK_COLOR_COLNO} ||= 'bold yellow'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{"ACK_COLOR_COLNO"} ||= "bold yellow"
MC/DC0%0/1
$ENV{"ACK_COLOR_COLNO"} ||= "bold yellow"
$ENV{"ACK_COLOR_COLNO"}
Truth table50%1/2
A
A= $ENV{"ACK_COLOR_COLNO"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 576 | App::Ack::ConfigLoader::configure_parser( 'no_auto_abbrev', 'pass_through' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | Getopt::Long::GetOptions( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 3 | ▶ | help => sub { App::Ack::show_help(); exit; }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 3 | ▶ | version => sub { App::Ack::print( App::Ack::get_version_statement() ); exit; }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 2 | ▶ | man => sub { App::Ack::show_man(); }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 576 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 568 | ▶ | if ( !@ARGV ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | App::Ack::show_help(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | exit 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 568 | my @arg_sources = App::Ack::ConfigLoader::retrieve_arg_sources(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 567 | my $opt = App::Ack::ConfigLoader::process_args( @arg_sources ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 367 | $opt_1 = $opt->{1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 367 | $opt_A = $opt->{A}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 367 | $opt_B = $opt->{B}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 367 | $opt_break = $opt->{break}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 367 | $opt_c = $opt->{c}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 367 | $opt_color = $opt->{color}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 367 | $opt_column = $opt->{column}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 367 | $opt_debug = $opt->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 367 | $opt_f = $opt->{f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 367 | $opt_g = $opt->{g}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 367 | $opt_heading = $opt->{heading}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 367 | $opt_L = $opt->{L}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 367 | $opt_l = $opt->{l}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 367 | $opt_m = $opt->{m}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 367 | $opt_output = $opt->{output}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 367 | $opt_p = $opt->{p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 367 | $opt_passthru = $opt->{passthru}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 367 | $opt_range_start = $opt->{range_start}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 367 | $opt_range_end = $opt->{range_end}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 367 | $opt_regex = $opt->{regex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 367 | $opt_show_filename = $opt->{show_filename}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 367 | $opt_show_types = $opt->{show_types}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 367 | $opt_underline = $opt->{underline}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 367 | $opt_v = $opt->{v}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 367 | ▶ | if ( $opt_show_types && not( $opt_f || $opt_g ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$main::opt_show_types and not $main::opt_f || $main::opt_g
$main::opt_f || $main::opt_g
MC/DC100%3/3
$main::opt_show_types and not $main::opt_f || $main::opt_g
$main::opt_show_types
$main::opt_f
$main::opt_g
Truth table100%4/4
A and not(B || C)
A= $main::opt_show_typesB= $main::opt_fC= $main::opt_g
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | App::Ack::die( '--show-types can only be used with -f or -g.' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 366 | ▶ | if ( $opt_range_start ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | ($opt_range_start, undef) = App::Ack::build_regex( $opt_range_start, {} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 366 | ▶ | if ( $opt_range_end ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ($opt_range_end, undef) = App::Ack::build_regex( $opt_range_end, {} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 366 | ▶ | $using_ranges = $opt_range_start || $opt_range_end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$main::opt_range_start || $main::opt_range_end
MC/DC50%1/2
$main::opt_range_start || $main::opt_range_end
$main::opt_range_start
$main::opt_range_end
Truth table66%2/3
A || B
A= $main::opt_range_startB= $main::opt_range_end
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 366 | $App::Ack::report_bad_filenames = !$opt->{s}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 366 | ▶ | $App::Ack::ors = $opt->{print0} ? "\0" : "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 366 | ▶ | if ( !defined($opt_color) && !$opt_g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $main::opt_color or $main::opt_g
MC/DC100%2/2
defined $main::opt_color or $main::opt_g
defined $main::opt_color
$main::opt_g
Truth table100%3/3
A or B
A= defined $main::opt_colorB= $main::opt_g
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 318 | my $windows_color = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 318 | ▶ | if ( $App::Ack::is_windows ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $windows_color = eval { require Win32::Console::ANSI; }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 318 | ▶ | $opt_color = !App::Ack::output_to_pipe() && $windows_color; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
!App::Ack::output_to_pipe() && $windows_color
MC/DC0%0/2
!App::Ack::output_to_pipe() && $windows_color
!App::Ack::output_to_pipe()
$windows_color
Truth table33%1/3
not(A) && B
A= !App::Ack::output_to_pipe()B= $windows_color
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 366 | ▶ | $opt_heading //= !App::Ack::output_to_pipe(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$main::opt_heading //= !App::Ack::output_to_pipe()
MC/DC100%1/1
$main::opt_heading //= !App::Ack::output_to_pipe()
$main::opt_heading
Truth table100%2/2
A
A= $main::opt_heading
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 366 | ▶ | $opt_break //= !App::Ack::output_to_pipe(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$main::opt_break //= !App::Ack::output_to_pipe()
MC/DC100%1/1
$main::opt_break //= !App::Ack::output_to_pipe()
$main::opt_break
Truth table100%2/2
A
A= $main::opt_break
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 366 | ▶ | if ( defined($opt->{H}) || defined($opt->{h}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $opt->{"H"} or defined $opt->{"h"}
MC/DC100%2/2
defined $opt->{"H"} or defined $opt->{"h"}
defined $opt->{"H"}
defined $opt->{"h"}
Truth table100%3/3
A or B
A= defined $opt->{"H"}B= defined $opt->{"h"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 10 | ▶ | $opt_show_filename = $opt->{show_filename} = $opt->{H} && !$opt->{h}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opt->{'H'} && !$opt->{'h'}
MC/DC50%1/2
$opt->{'H'} && !$opt->{'h'}
$opt->{'H'}
!$opt->{'h'}
Truth table66%2/3
A && not(B)
A= $opt->{'H'}B= !$opt->{'h'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 366 | ▶ | if ( defined $opt_output ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # Expand out \t, \n and \r. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 7 | $opt_output =~ s/\\n/\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 7 | $opt_output =~ s/\\r/\r/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 7 | $opt_output =~ s/\\t/\t/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 7 | my @supported_special_variables = ( 1..9, qw( _ . ` & ' + f ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | @special_vars_used_by_opt_output = grep { $opt_output =~ /\$$_/ } @supported_special_variables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # If the $opt_output contains $&, $` or $', those vars won't be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # captured until they're used at least once in the program. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # Do the eval to make this happen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 7 | for my $i ( @special_vars_used_by_opt_output ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 19 | ▶ | if ( $i eq q{&} || $i eq q{'} || $i eq q{`} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$i eq "&" or $i eq "'" or $i eq "`"
$i eq "&" or $i eq "'"
MC/DC66%2/3
$i eq "&" or $i eq "'" or $i eq "`"
$i eq "&"
$i eq "'"
$i eq "`"
Truth table75%3/4
A or B or C
A= $i eq "&"B= $i eq "'"C= $i eq "`"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 579 | ▶ | no warnings; # They will be undef, so don't warn. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | eval qq{"\$$i"}; ## no critic ( ErrorHandling::RequireCheckingReturnValueOfEval ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # Set up file filters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 366 | my $files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 366 | ▶ | if ( $App::Ack::is_filter_mode && !$opt->{files_from} ) { # probably -x | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$App::Ack::is_filter_mode and not $opt->{"files_from"}
MC/DC100%2/2
$App::Ack::is_filter_mode and not $opt->{"files_from"}
$App::Ack::is_filter_mode
not $opt->{"files_from"}
Truth table100%3/3
A and not(B)
A= $App::Ack::is_filter_modeB= not $opt->{"files_from"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 6 | $files = App::Ack::Files->from_stdin(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 6 | ▶ | $opt_regex //= shift @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$main::opt_regex //= shift @ARGV
MC/DC50%1/2
$main::opt_regex //= shift @ARGV
$main::opt_regex
shift @ARGV
Truth table66%2/3
A //= B
A= $main::opt_regexB= shift @ARGV
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 6 | ▶ | defined $opt_regex or App::Ack::die( 'No regular expression found.' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 5 | ($re_match, $re_not, $re_hilite, $re_scan) = App::Ack::build_all_regexes( $opt_regex, $opt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 5 | $stats{re_match} = $re_match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 5 | $stats{re_not} = $re_not; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | $stats{re_hilite} = $re_hilite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 5 | $stats{re_scan} = $re_scan; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 360 | ▶ | if ( $opt_f ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # No need to check for regex, since mutex options are handled elsewhere. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 266 | ▶ | $opt_regex //= shift @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$main::opt_regex //= shift @ARGV
MC/DC0%0/2
$main::opt_regex //= shift @ARGV
$main::opt_regex
shift @ARGV
Truth table66%2/3
A //= B
A= $main::opt_regexB= shift @ARGV
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 266 | ▶ | defined $opt_regex or App::Ack::die( 'No regular expression found.' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 266 | ($re_match, $re_not, $re_hilite, $re_scan) = App::Ack::build_all_regexes( $opt_regex, $opt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 232 | $stats{re_match} = $re_match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 232 | $stats{re_not} = $re_not; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 232 | $stats{re_hilite} = $re_hilite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 232 | $stats{re_scan} = $re_scan; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 326 | my @start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 326 | ▶ | if ( not defined $opt->{files_from} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 317 | @start = @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 326 | ▶ | if ( !exists($opt->{show_filename}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 316 | ▶ | unless(@start == 1 && !(-d $start[0])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@start == 1 and not -d $start[0]
MC/DC100%2/2
@start == 1 and not -d $start[0]
@start == 1
not -d $start[0]
Truth table100%3/3
A and not(B)
A= @start == 1B= not -d $start[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 195 | $opt_show_filename = $opt->{show_filename} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 326 | ▶ | if ( defined $opt->{files_from} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 9 | $files = App::Ack::Files->from_file( $opt, $opt->{files_from} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 9 | ▶ | exit 1 unless $files; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 317 | ▶ | @start = ('.') unless @start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 317 | foreach my $target (@start) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 426 | ▶ | if ( !-e $target && $App::Ack::report_bad_filenames) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not -e $target and $App::Ack::report_bad_filenames
MC/DC50%1/2
not -e $target and $App::Ack::report_bad_filenames
not -e $target
$App::Ack::report_bad_filenames
Truth table66%2/3
not(A) and B
A= not -e $targetB= $App::Ack::report_bad_filenames
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | App::Ack::warn( "$target: No such file or directory" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 317 | $opt->{file_filter} = _compile_file_filter($opt, \@start); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 317 | $opt->{descend_filter} = _compile_descend_filter($opt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 317 | $files = App::Ack::Files->from_argv( $opt, \@start ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 330 | ▶ | App::Ack::set_up_pager( $opt->{pager} ) if defined $opt->{pager}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 330 | my $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 330 | ▶ | if ( $opt_f || $opt_g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$main::opt_f or $main::opt_g
MC/DC100%2/2
$main::opt_f or $main::opt_g
$main::opt_f
$main::opt_g
Truth table100%3/3
A or B
A= $main::opt_fB= $main::opt_g
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 102 | $nmatches = file_loop_fg( $files ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | elsif ( $opt_c ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 6 | $nmatches = file_loop_c( $files ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ▶ | elsif ( $opt_l || $opt_L ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$main::opt_l or $main::opt_L
MC/DC100%2/2
$main::opt_l or $main::opt_L
$main::opt_l
$main::opt_L
Truth table100%3/3
A or B
A= $main::opt_lB= $main::opt_L
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 32 | $nmatches = file_loop_lL( $files ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 190 | $nmatches = file_loop_normal( $files ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 330 | ▶ | if ( $opt_debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | require List::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my @stats = qw( re_match re_scan re_not prescans linescans filematches linematches ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $width = List::Util::max( map { length } @stats ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | for my $stat ( @stats ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | App::Ack::warn( sprintf( '%-*.*s = %s', $width, $width, $stat, $stats{$stat} // 'undef' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$main::stats{$stat} // "undef"
MC/DC0%0/1
$main::stats{$stat} // "undef"
$main::stats{$stat}
Truth table0%0/2
A
A= $main::stats{$stat}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 330 | close $App::Ack::fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 330 | App::Ack::exit_from_ack( $nmatches ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } # End of MAIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # Sanitize a filename for display: replace control chars with '?' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 800 | ▶ | sub _safe_filename { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_safe_filename: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 800 | my $s = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 800 | $s =~ s/[^\x20-\x7E\t]/?/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 800 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 102 | ▶ | sub file_loop_fg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_loop_fg: called CC=6 SCAR=18.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 102 | my $files = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 102 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 102 | ▶ | while ( defined( my $file = $files->next ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 216 | ▶ | if ( $opt_show_types ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | App::Ack::show_types( $file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | elsif ( $opt_g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 25 | print_line_with_options( undef, _safe_filename( $file->name ), 0, $App::Ack::ors ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 189 | App::Ack::say( _safe_filename( $file->name ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 216 | ++$nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 216 | ▶ | last if defined($opt_m) && ($nmatches >= $opt_m); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $main::opt_m and $nmatches >= $main::opt_m
MC/DC0%0/2
defined $main::opt_m and $nmatches >= $main::opt_m
defined $main::opt_m
$nmatches >= $main::opt_m
Truth table33%1/3
A and B
A= defined $main::opt_mB= $nmatches >= $main::opt_m
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 102 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 6 | ▶ | sub file_loop_c { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_loop_c: called CC=9 SCAR=22.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 6 | my $files = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 6 | my $nmatched_files = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 6 | my $total_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 6 | ▶ | while ( defined( my $file = $files->next ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 240 | my $matches_for_this_file = count_matches_in_file( $file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 240 | ▶ | if ( $matches_for_this_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 36 | ++$nmatched_files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 240 | ▶ | if ( not $opt_show_filename ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | $total_count += $matches_for_this_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 238 | ▶ | if ( !$opt_l || $matches_for_this_file > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $main::opt_l or $matches_for_this_file > 0
MC/DC0%0/2
not $main::opt_l or $matches_for_this_file > 0
not $main::opt_l
$matches_for_this_file > 0
Truth table33%1/3
not(A) or B
A= not $main::opt_lB= $matches_for_this_file > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 238 | ▶ | if ( $opt_show_filename ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 238 | my $display_filename = $file->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 238 | ▶ | if ( $opt_color ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $display_filename = Term::ANSIColor::colored($display_filename, $ENV{ACK_COLOR_FILENAME}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 238 | App::Ack::say( $display_filename, ':', $matches_for_this_file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | App::Ack::say( $matches_for_this_file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 6 | ▶ | if ( !$opt_show_filename ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 2 | App::Ack::say( $total_count ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 6 | return $nmatched_files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 32 | ▶ | sub file_loop_lL { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_loop_lL: called CC=7 SCAR=19.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 32 | my $files = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 32 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 32 | ▶ | while ( defined( my $file = $files->next ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 1231 | my $is_match = count_matches_in_file( $file, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 1231 | ▶ | if ( $opt_L ? !$is_match : $is_match ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 214 | App::Ack::say( $file->name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 214 | ++$nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 214 | ▶ | last if $opt_1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 214 | ▶ | last if defined($opt_m) && ($nmatches >= $opt_m); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $main::opt_m and $nmatches >= $main::opt_m
MC/DC0%0/2
defined $main::opt_m and $nmatches >= $main::opt_m
defined $main::opt_m
$nmatches >= $main::opt_m
Truth table33%1/3
A and B
A= defined $main::opt_mB= $nmatches >= $main::opt_m
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 32 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 317 | ▶ | sub _compile_descend_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compile_descend_filter: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 317 | my ( $opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 317 | my $idirs = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 317 | my $dont_ignore_dirs = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 317 | ▶ | for my $filter (@{$opt->{idirs} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opt->{'idirs'} || []
MC/DC100%1/1
$opt->{'idirs'} || []
$opt->{'idirs'}
Truth table100%2/2
A
A= $opt->{'idirs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 333 | ▶ | if ($filter->is_inverted()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 13 | $dont_ignore_dirs++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 320 | $idirs++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # If we have one or more --noignore-dir directives, we can't ignore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # entire subdirectory hierarchies, so we return an "accept all" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # filter and scrutinize the files more in _compile_file_filter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 317 | ▶ | return if $dont_ignore_dirs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 305 | ▶ | return unless $idirs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 304 | $idirs = $opt->{idirs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 1578 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 1578 | my $file = App::Ack::File->new($File::Next::dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 1578 | return !grep { $_->filter($file) } @{$idirs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 304 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 317 | ▶ | sub _compile_file_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compile_file_filter: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 317 | my ( $opt, $start ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 317 | my $ifiles_filters = $opt->{ifiles}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 317 | ▶ | my $filters = $opt->{'filters'} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opt->{'filters'} || []
MC/DC0%0/1
$opt->{'filters'} || []
$opt->{'filters'}
Truth table50%1/2
A
A= $opt->{'filters'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 317 | my $direct_filters = App::Ack::Filter::Collection->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 317 | my $inverse_filters = App::Ack::Filter::Collection->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 317 | foreach my $filter (@{$filters}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 353 | ▶ | if ($filter->is_inverted()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # We want to check if files match the uninverted filters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 10 | $inverse_filters->add($filter->invert()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 343 | $direct_filters->add($filter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 317 | my %is_member_of_starting_set = map { (get_file_id($_) => 1) } @{$start}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 317 | ▶ | my @ignore_dir_filter = @{$opt->{idirs} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opt->{'idirs'} || []
MC/DC100%1/1
$opt->{'idirs'} || []
$opt->{'idirs'}
Truth table100%2/2
A
A= $opt->{'idirs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 317 | my @is_inverted = map { $_->is_inverted() } @ignore_dir_filter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # This depends on InverseFilter->invert returning the original filter (for optimization). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 317 | ▶ | @ignore_dir_filter = map { $_->is_inverted() ? $_->invert() : $_ } @ignore_dir_filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 317 | my $dont_ignore_dir_filter = grep { $_ } @is_inverted; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 317 | my $previous_dir = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 317 | my $previous_dir_ignore_result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 11393 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=23 SCAR=31.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 11393 | ▶ | if ( $opt_g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 113 | my $match = ($File::Next::name =~ /$re_match/o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 113 | ▶ | if ( $match && $re_not ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$match and $main::re_not
MC/DC0%0/2
$match and $main::re_not
$match
$main::re_not
Truth table66%2/3
A and B
A= $matchB= $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $match = ($File::Next::name !~ /$re_not/o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 113 | ▶ | if ( $match ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 26 | ▶ | return 0 if $opt_v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 87 | ▶ | return 0 if !$opt_v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # ack always selects files that are specified on the command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # line, regardless of filetype. If you want to ack a JPEG, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # and say "ack foo whatever.jpg" it will do it for you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 11306 | ▶ | return 1 if $is_member_of_starting_set{ get_file_id($File::Next::name) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 11147 | ▶ | if ( $dont_ignore_dir_filter ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 1056 | ▶ | if ( $previous_dir eq $File::Next::dir ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 864 | ▶ | if ( $previous_dir_ignore_result ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 106 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 192 | my @dirs = File::Spec->splitdir($File::Next::dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 192 | my $is_ignoring; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 192 | ▶ | for ( my $i = 0; $i < @dirs; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 684 | my $dir_rsrc = App::Ack::File->new(File::Spec->catfile(@dirs[0 .. $i])); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 684 | my $j = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 684 | for my $filter (@ignore_dir_filter) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 1653 | ▶ | if ( $filter->filter($dir_rsrc) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 145 | $is_ignoring = !$is_inverted[$j]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 1653 | $j++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 192 | $previous_dir = $File::Next::dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 192 | $previous_dir_ignore_result = $is_ignoring; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 192 | ▶ | if ( $is_ignoring ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 59 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # Ignore named pipes found in directory searching. Named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | # pipes created by subprocesses get specified on the command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | # line, so the rule of "always select whatever is on the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | # command line" wins. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 10982 | ▶ | return 0 if -p $File::Next::name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | # We can't handle unreadable filenames; report them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 10981 | ▶ | if ( not -r _ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 579 | ▶ | use filetest 'access'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 2 | ▶ | if ( not -R $File::Next::name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 2 | ▶ | if ( $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | App::Ack::warn( "${File::Next::name}: cannot open file for reading" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 10979 | my $file = App::Ack::File->new($File::Next::name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 10979 | ▶ | if ( $ifiles_filters && $ifiles_filters->filter($file) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$ifiles_filters and $ifiles_filters->filter($file)
MC/DC100%2/2
$ifiles_filters and $ifiles_filters->filter($file)
$ifiles_filters
$ifiles_filters->filter($file)
Truth table100%3/3
A and B
A= $ifiles_filtersB= $ifiles_filters->filter($file)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1442 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 9537 | my $match_found = $direct_filters->filter($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # Don't bother invoking inverse filters unless we consider the current file a match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 9537 | ▶ | if ( $match_found && $inverse_filters->filter( $file ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$match_found and $inverse_filters->filter($file)
MC/DC100%2/2
$match_found and $inverse_filters->filter($file)
$match_found
$inverse_filters->filter($file)
Truth table100%3/3
A and B
A= $match_foundB= $inverse_filters->filter($file)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 52 | $match_found = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 9537 | return $match_found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 317 | }; # End of compiled sub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # Returns a (fairly) unique identifier for a file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # Use this function to compare two files to see if they're | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # equal (ie. the same file, but with a different path/links/etc). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 11732 | ▶ | sub get_file_id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_id: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 11732 | my ( $filename ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 11732 | ▶ | if ( $App::Ack::is_windows ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | return File::Next::reslash( $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # XXX Is this the best method? It always hits the FS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 11732 | ▶ | if ( my ( $dev, $inode ) = (stat($filename))[0, 1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 11730 | return join(':', $dev, $inode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # XXX This could be better. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 2 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | my $match_colno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # Number of context lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my $n_before_ctx_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | my $n_after_ctx_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | # Array to keep track of lines that might be required for a "before" context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | my @before_context_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | # Position to insert next line in @before_context_buf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my $before_context_pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # Number of "after" context lines still pending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | my $after_context_pending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # Number of latest line that got printed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | my $printed_lineno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | my $is_first_match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | state $has_printed_from_any_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 190 | ▶ | sub file_loop_normal { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_loop_normal: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 190 | my $files = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 190 | ▶ | $n_before_ctx_lines = $opt_output ? 0 : ($opt_B || 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$main::opt_B or 0
MC/DC100%1/1
$main::opt_B or 0
$main::opt_B
Truth table100%2/2
A
A= $main::opt_B
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 190 | ▶ | $n_after_ctx_lines = $opt_output ? 0 : ($opt_A || 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$main::opt_A or 0
MC/DC100%1/1
$main::opt_A or 0
$main::opt_A
Truth table100%2/2
A
A= $main::opt_A
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 190 | @before_context_buf = (undef) x $n_before_ctx_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 190 | $before_context_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 190 | ▶ | $is_tracking_context = $n_before_ctx_lines || $n_after_ctx_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$n_before_ctx_lines || $n_after_ctx_lines
MC/DC100%2/2
$n_before_ctx_lines || $n_after_ctx_lines
$n_before_ctx_lines
$n_after_ctx_lines
Truth table100%3/3
A || B
A= $n_before_ctx_linesB= $n_after_ctx_lines
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 190 | $is_first_match = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 190 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 190 | ▶ | while ( defined( my $file = $files->next ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 1937 | ▶ | if ($is_tracking_context) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 124 | $printed_lineno = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 124 | $after_context_pending = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 124 | ▶ | if ( $opt_heading ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 23 | $is_first_match = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 1937 | my $needs_line_scan = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1937 | ▶ | if ( !$opt_passthru && !$opt_v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_passthru or $main::opt_v
MC/DC100%2/2
$main::opt_passthru or $main::opt_v
$main::opt_passthru
$main::opt_v
Truth table100%3/3
A or B
A= $main::opt_passthruB= $main::opt_v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 1925 | $stats{prescans}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 1925 | ▶ | if ( $file->may_be_present( $re_scan ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 574 | $file->reset(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 1351 | $needs_line_scan = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 1937 | ▶ | if ( $needs_line_scan ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 586 | $stats{linescans}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 586 | $nmatches += print_matches_in_file( $file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 1937 | ▶ | last if $opt_1 && $nmatches; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::opt_1 and $nmatches
MC/DC0%0/2
$main::opt_1 and $nmatches
$main::opt_1
$nmatches
Truth table33%1/3
A and B
A= $main::opt_1B= $nmatches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 190 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 586 | ▶ | sub print_matches_in_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_matches_in_file: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 586 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 586 | my $filename = _safe_filename($file->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 586 | my $fh = $file->open; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 586 | ▶ | if ( !$fh ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 3 | ▶ | if ( $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 2 | App::Ack::warn( "$filename: $!" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 583 | my $display_filename = $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 583 | ▶ | if ( $opt_show_filename && $opt_heading && $opt_color ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$main::opt_show_filename and $main::opt_heading and $main::opt_color
$main::opt_show_filename and $main::opt_heading
MC/DC100%3/3
$main::opt_show_filename and $main::opt_heading and $main::opt_color
$main::opt_show_filename
$main::opt_heading
$main::opt_color
Truth table100%4/4
A and B and C
A= $main::opt_show_filenameB= $main::opt_headingC= $main::opt_color
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 10 | $display_filename = Term::ANSIColor::colored($display_filename, $ENV{ACK_COLOR_FILENAME}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | # Check for context before the main loop, so we don't pay for it if we don't need it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 583 | my $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 583 | ▶ | my $max_count = $opt_m || -1; # Go negative for no limit so it can never reduce to 0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$main::opt_m || -1
MC/DC100%1/1
$main::opt_m || -1
$main::opt_m
Truth table100%2/2
A
A= $main::opt_m
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 583 | ▶ | if ( $is_tracking_context ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 47 | $nmatches = pmif_context( $fh, $filename, $display_filename, $max_count ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | elsif ( $opt_passthru ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 6 | $nmatches = pmif_passthru( $fh, $filename, $display_filename, $max_count ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | elsif ( $opt_v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 3 | $nmatches = pmif_opt_v( $fh, $filename, $display_filename, $max_count ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 527 | $nmatches = pmif_normal( $fh, $filename, $display_filename, $max_count ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 583 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 47 | ▶ | sub pmif_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pmif_context: called CC=26 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 47 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 47 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 47 | my $display_filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 47 | my $max_count = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 47 | my $in_range = range_setup(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 47 | my $has_printed_from_this_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 47 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 47 | $after_context_pending = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 47 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 47 | ▶ | while ( <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 5508 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 5508 | $match_colno = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 5508 | ▶ | $in_range = 1 if ( $using_ranges && !$in_range && defined($opt_range_start) && /$opt_range_start/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges and not $in_range and defined $main::opt_range_start
$main::using_ranges and not $in_range
MC/DC0%0/4
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges
not $in_range
defined $main::opt_range_start
/$main::opt_range_start/o
Truth table20%1/5
A and not(B) and C and D
A= $main::using_rangesB= not $in_rangeC= defined $main::opt_range_startD= /$main::opt_range_start/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 5508 | my $does_match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 5508 | ▶ | if ( $in_range ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 5508 | $does_match = /$re_match/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 5508 | ▶ | if ( $does_match && defined($re_not) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$does_match and defined $main::re_not
MC/DC0%0/2
$does_match and defined $main::re_not
$does_match
defined $main::re_not
Truth table66%2/3
A and B
A= $does_matchB= defined $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | local @-; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $does_match = !/$re_not/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 5508 | ▶ | if ( $opt_v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 42 | $does_match = !$does_match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 5466 | ▶ | if ( $does_match ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | # @- = @LAST_MATCH_START | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 25 | $match_colno = $-[0] + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 5508 | ▶ | if ( $does_match && $max_count ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$does_match and $max_count
MC/DC100%2/2
$does_match and $max_count
$does_match
$max_count
Truth table100%3/3
A and B
A= $does_matchB= $max_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 66 | ▶ | if ( !$has_printed_from_this_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 17 | $stats{filematches}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 17 | ▶ | if ( $opt_break && $has_printed_from_any_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_break and $has_printed_from_any_file
MC/DC100%2/2
$main::opt_break and $has_printed_from_any_file
$main::opt_break
$has_printed_from_any_file
Truth table100%3/3
A and B
A= $main::opt_breakB= $has_printed_from_any_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 3 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 17 | ▶ | if ( $opt_show_filename && $opt_heading ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_show_filename and $main::opt_heading
MC/DC100%2/2
$main::opt_show_filename and $main::opt_heading
$main::opt_show_filename
$main::opt_heading
Truth table100%3/3
A and B
A= $main::opt_show_filenameB= $main::opt_heading
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 6 | App::Ack::say( $display_filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 66 | print_line_with_context( $filename, $_, $. ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 66 | $has_printed_from_this_file = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 66 | $stats{linematches}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 66 | $nmatches++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 66 | $max_count--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 5442 | ▶ | if ( $after_context_pending ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | # Disable $opt_column since there are no matches in the context lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 32 | local $opt_column = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 32 | print_line_with_options( $filename, $_, $., '-' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 32 | --$after_context_pending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | elsif ( $n_before_ctx_lines ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | # Save line for "before" context. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 3579 | $before_context_buf[$before_context_pos] = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 3579 | $before_context_pos = ($before_context_pos+1) % $n_before_ctx_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 5508 | ▶ | $in_range = 0 if ( $using_ranges && $in_range && defined($opt_range_end) && /$opt_range_end/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges and $in_range and defined $main::opt_range_end
$main::using_ranges and $in_range
MC/DC0%0/4
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges
$in_range
defined $main::opt_range_end
/$main::opt_range_end/o
Truth table20%1/5
A and B and C and D
A= $main::using_rangesB= $in_rangeC= defined $main::opt_range_endD= /$main::opt_range_end/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 5508 | ▶ | last if ($max_count == 0) && ($after_context_pending == 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max_count == 0 and $after_context_pending == 0
MC/DC100%2/2
$max_count == 0 and $after_context_pending == 0
$max_count == 0
$after_context_pending == 0
Truth table100%3/3
A and B
A= $max_count == 0B= $after_context_pending == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 47 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 6 | ▶ | sub pmif_passthru { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pmif_passthru: called CC=23 SCAR=35.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 6 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 6 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 6 | my $display_filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 6 | my $max_count = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 6 | my $in_range = range_setup(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 6 | my $has_printed_from_this_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 6 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 6 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 6 | ▶ | while ( <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 134 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 134 | ▶ | $in_range = 1 if ( $using_ranges && !$in_range && defined($opt_range_start) && /$opt_range_start/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges and not $in_range and defined $main::opt_range_start
$main::using_ranges and not $in_range
MC/DC75%3/4
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges
not $in_range
defined $main::opt_range_start
/$main::opt_range_start/o
Truth table80%4/5
A and not(B) and C and D
A= $main::using_rangesB= not $in_rangeC= defined $main::opt_range_startD= /$main::opt_range_start/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 134 | $match_colno = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 134 | my $does_match = /$re_match/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 134 | ▶ | if ( $does_match && defined($re_not) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$does_match and defined $main::re_not
MC/DC100%2/2
$does_match and defined $main::re_not
$does_match
defined $main::re_not
Truth table100%3/3
A and B
A= $does_matchB= defined $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 3 | local @-; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 3 | $does_match = !/$re_not/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 134 | ▶ | if ( $in_range && $does_match ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$in_range and $does_match
MC/DC100%2/2
$in_range and $does_match
$in_range
$does_match
Truth table100%3/3
A and B
A= $in_rangeB= $does_match
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 16 | $match_colno = $-[0] + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 16 | ▶ | if ( !$has_printed_from_this_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | if ( $opt_break && $has_printed_from_any_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$main::opt_break and $has_printed_from_any_file
MC/DC0%0/2
$main::opt_break and $has_printed_from_any_file
$main::opt_break
$has_printed_from_any_file
Truth table0%0/3
A and B
A= $main::opt_breakB= $has_printed_from_any_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | ▶ | if ( $opt_show_filename && $opt_heading ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$main::opt_show_filename and $main::opt_heading
MC/DC0%0/2
$main::opt_show_filename and $main::opt_heading
$main::opt_show_filename
$main::opt_heading
Truth table0%0/3
A and B
A= $main::opt_show_filenameB= $main::opt_heading
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | App::Ack::say( $display_filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 16 | print_line_with_options( $filename, $_, $., ':' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 16 | $has_printed_from_this_file = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 16 | $nmatches++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 16 | $max_count--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 118 | ▶ | if ( $opt_break && !$has_printed_from_this_file && $has_printed_from_any_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$main::opt_break and not $has_printed_from_this_file and $has_printed_from_any_file
$main::opt_break and not $has_printed_from_this_file
MC/DC0%0/3
$main::opt_break and not $has_printed_from_this_file and $has_printed_from_any_file
$main::opt_break
not $has_printed_from_this_file
$has_printed_from_any_file
Truth table25%1/4
A and not(B) and C
A= $main::opt_breakB= not $has_printed_from_this_fileC= $has_printed_from_any_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 118 | print_line_with_options( $filename, $_, $., '-', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 118 | $has_printed_from_this_file = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 134 | ▶ | $in_range = 0 if ( $using_ranges && $in_range && defined($opt_range_end) && /$opt_range_end/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges and $in_range and defined $main::opt_range_end
$main::using_ranges and $in_range
MC/DC75%3/4
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges
$in_range
defined $main::opt_range_end
/$main::opt_range_end/o
Truth table80%4/5
A and B and C and D
A= $main::using_rangesB= $in_rangeC= defined $main::opt_range_endD= /$main::opt_range_end/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 134 | ▶ | last if $max_count == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 6 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 3 | ▶ | sub pmif_opt_v { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pmif_opt_v: called CC=20 SCAR=36.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 3 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 3 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 3 | my $display_filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 3 | my $max_count = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 3 | my $in_range = range_setup(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 3 | my $has_printed_from_this_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 3 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 3 | $match_colno = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 3 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 3 | ▶ | while ( <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 52 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 52 | ▶ | $in_range = 1 if ( $using_ranges && !$in_range && defined($opt_range_start) && /$opt_range_start/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges and not $in_range and defined $main::opt_range_start
$main::using_ranges and not $in_range
MC/DC0%0/4
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges
not $in_range
defined $main::opt_range_start
/$main::opt_range_start/o
Truth table20%1/5
A and not(B) and C and D
A= $main::using_rangesB= not $in_rangeC= defined $main::opt_range_startD= /$main::opt_range_start/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 52 | ▶ | if ( $in_range ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 52 | my $does_match = /$re_match/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 52 | ▶ | if ( $does_match && defined($re_not) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$does_match and defined $main::re_not
MC/DC0%0/2
$does_match and defined $main::re_not
$does_match
defined $main::re_not
Truth table66%2/3
A and B
A= $does_matchB= defined $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # local @-; No need to localize this because we don't use @-. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $does_match = !/$re_not/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 52 | ▶ | if ( !$does_match ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 50 | ▶ | if ( !$has_printed_from_this_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 3 | ▶ | if ( $opt_break && $has_printed_from_any_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::opt_break and $has_printed_from_any_file
MC/DC0%0/2
$main::opt_break and $has_printed_from_any_file
$main::opt_break
$has_printed_from_any_file
Truth table33%1/3
A and B
A= $main::opt_breakB= $has_printed_from_any_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 3 | ▶ | if ( $opt_show_filename && $opt_heading ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::opt_show_filename and $main::opt_heading
MC/DC0%0/2
$main::opt_show_filename and $main::opt_heading
$main::opt_show_filename
$main::opt_heading
Truth table33%1/3
A and B
A= $main::opt_show_filenameB= $main::opt_heading
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | App::Ack::say( $display_filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 50 | print_line_with_context( $filename, $_, $. ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 50 | $has_printed_from_this_file = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 50 | $nmatches++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 50 | $max_count--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 52 | ▶ | $in_range = 0 if ( $using_ranges && $in_range && defined($opt_range_end) && /$opt_range_end/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges and $in_range and defined $main::opt_range_end
$main::using_ranges and $in_range
MC/DC0%0/4
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges
$in_range
defined $main::opt_range_end
/$main::opt_range_end/o
Truth table20%1/5
A and B and C and D
A= $main::using_rangesB= $in_rangeC= defined $main::opt_range_endD= /$main::opt_range_end/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 52 | ▶ | last if $max_count == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 3 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 527 | ▶ | sub pmif_normal { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pmif_normal: called CC=25 SCAR=37.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 527 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 527 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 527 | my $display_filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 527 | my $max_count = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 527 | my $in_range = range_setup(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 527 | my $has_printed_from_this_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 527 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 527 | my $last_match_lineno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 527 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 527 | ▶ | while ( <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 66205 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 66205 | ▶ | $in_range = 1 if ( $using_ranges && !$in_range && defined($opt_range_start) && /$opt_range_start/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges and not $in_range and defined $main::opt_range_start
$main::using_ranges and not $in_range
MC/DC0%0/4
$main::using_ranges and not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
$main::using_ranges
not $in_range
defined $main::opt_range_start
/$main::opt_range_start/o
Truth table20%1/5
A and not(B) and C and D
A= $main::using_rangesB= not $in_rangeC= defined $main::opt_range_startD= /$main::opt_range_start/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 66205 | ▶ | if ( $in_range ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 66205 | $match_colno = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 66205 | my $is_match = /$re_match/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 66205 | ▶ | if ( $is_match && defined($re_not) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$is_match and defined $main::re_not
MC/DC100%2/2
$is_match and defined $main::re_not
$is_match
defined $main::re_not
Truth table100%3/3
A and B
A= $is_matchB= defined $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 42 | local @-; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 42 | $is_match = !/$re_not/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 66205 | ▶ | if ( $is_match ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 7041 | $match_colno = $-[0] + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 7041 | ▶ | if ( !$has_printed_from_this_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 502 | $stats{filematches}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 502 | ▶ | if ( $opt_break && $has_printed_from_any_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_break and $has_printed_from_any_file
MC/DC100%2/2
$main::opt_break and $has_printed_from_any_file
$main::opt_break
$has_printed_from_any_file
Truth table100%3/3
A and B
A= $main::opt_breakB= $has_printed_from_any_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 2 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 502 | ▶ | if ( $opt_show_filename && $opt_heading ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_show_filename and $main::opt_heading
MC/DC100%2/2
$main::opt_show_filename and $main::opt_heading
$main::opt_show_filename
$main::opt_heading
Truth table100%3/3
A and B
A= $main::opt_show_filenameB= $main::opt_heading
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 7 | App::Ack::say( $display_filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 7041 | ▶ | if ( $opt_p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | ▶ | if ( $last_match_lineno ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | if ( $. > $last_match_lineno + $opt_p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | ▶ | elsif ( !$opt_break && $has_printed_from_any_file ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $main::opt_break and $has_printed_from_any_file
MC/DC0%0/2
not $main::opt_break and $has_printed_from_any_file
not $main::opt_break
$has_printed_from_any_file
Truth table0%0/3
not(A) and B
A= not $main::opt_breakB= $has_printed_from_any_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | App::Ack::print_blank_line(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 7041 | s/[\r\n]+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 7041 | print_line_with_options( $filename, $_, $., ':' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 7041 | $has_printed_from_this_file = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 7041 | $nmatches++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 7041 | $stats{linematches}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 7041 | $max_count--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 7041 | $last_match_lineno = $.; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 66205 | ▶ | $in_range = 0 if ( $using_ranges && $in_range && defined($opt_range_end) && /$opt_range_end/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges and $in_range and defined $main::opt_range_end
$main::using_ranges and $in_range
MC/DC0%0/4
$main::using_ranges and $in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$main::using_ranges
$in_range
defined $main::opt_range_end
/$main::opt_range_end/o
Truth table20%1/5
A and B and C and D
A= $main::using_rangesB= $in_rangeC= defined $main::opt_range_endD= /$main::opt_range_end/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 66205 | ▶ | last if $max_count == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 527 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 7373 | ▶ | sub print_line_with_options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_line_with_options: called CC=30 SCAR=41.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 7373 | my ( $filename, $line, $lineno, $separator, $skip_coloring ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 7373 | $has_printed_from_any_file = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 7373 | $printed_lineno = $lineno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 7373 | my @line_parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 7373 | ▶ | if ( $opt_show_filename && defined($filename) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_show_filename and defined $filename
MC/DC100%2/2
$main::opt_show_filename and defined $filename
$main::opt_show_filename
defined $filename
Truth table100%3/3
A and B
A= $main::opt_show_filenameB= defined $filename
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 6798 | my $disp_filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | my $disp_lineno; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 6798 | ▶ | if ( $opt_color ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 28 | $disp_filename = Term::ANSIColor::colored( $filename, $ENV{ACK_COLOR_FILENAME} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 28 | $disp_lineno = Term::ANSIColor::colored( $lineno, $ENV{ACK_COLOR_LINENO} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 6770 | $disp_filename = $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 6770 | $disp_lineno = $lineno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 6798 | ▶ | if ( $opt_heading ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 31 | push @line_parts, $disp_lineno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 6767 | push @line_parts, $disp_filename, $disp_lineno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 6798 | ▶ | if ( $opt_column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 5 | my $colno = get_match_colno(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 5 | ▶ | $colno = Term::ANSIColor::colored( $colno, $ENV{ACK_COLOR_COLNO} ) if $opt_color; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 5 | push @line_parts, $colno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 7373 | ▶ | if ( $opt_output ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 18 | ▶ | while ( $line =~ /$re_match/og ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 18 | my $output = $opt_output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 18 | ▶ | if ( @special_vars_used_by_opt_output ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 579 | ▶ | no strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | # Stash copies of the special variables because we can't rely | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | # on them not changing in the process of doing the s///. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 10 | ▶ | my %keep = map { ($_ => ${$_} // '') } @special_vars_used_by_opt_output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
${$_;} // ""
MC/DC100%1/1
${$_;} // ""
${$_;}
Truth table100%2/2
A
A= ${$_;}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 10 | ▶ | $keep{_} = $line if exists $keep{_}; # Manually set it because $_ gets reset in a map. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 10 | ▶ | $keep{f} = $filename if exists $keep{f}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 10 | my $special_vars_used_by_opt_output = join( '', @special_vars_used_by_opt_output ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 10 | $output =~ s/\$([$special_vars_used_by_opt_output])/$keep{$1}/ego; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 18 | App::Ack::say( join( $separator, @line_parts, $output ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 7355 | my $underline = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | # We have to do underlining before any highlighting because highlighting modifies string length. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 7355 | ▶ | if ( $opt_underline && !$skip_coloring ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::opt_underline and not $skip_coloring
MC/DC0%0/2
$main::opt_underline and not $skip_coloring
$main::opt_underline
not $skip_coloring
Truth table33%1/3
A and not(B)
A= $main::opt_underlineB= not $skip_coloring
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | ▶ | while ( $line =~ /$re_hilite/og ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | my $match_start = $-[0] // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$-[0] // (next)
MC/DC0%0/1
$-[0] // (next)
$-[0]
Truth table0%0/2
A
A= $-[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | my $match_end = $+[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | my $match_length = $match_end - $match_start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | last if $match_length <= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | my $spaces_needed = $match_start - length $underline; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | $underline .= (' ' x $spaces_needed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | $underline .= ('^' x $match_length); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 7355 | ▶ | if ( $opt_color && !$skip_coloring ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_color and not $skip_coloring
MC/DC100%2/2
$main::opt_color and not $skip_coloring
$main::opt_color
not $skip_coloring
Truth table100%3/3
A and not(B)
A= $main::opt_colorB= not $skip_coloring
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 119 | my $highlighted = 0; # If highlighted, need to escape afterwards. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 119 | ▶ | while ( $line =~ /$re_hilite/og ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 111 | ▶ | my $match_start = $-[0] // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$-[0] // (next)
MC/DC0%0/1
$-[0] // (next)
$-[0]
Truth table50%1/2
A
A= $-[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 111 | my $match_end = $+[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 111 | my $match_length = $match_end - $match_start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 111 | ▶ | last if $match_length <= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 111 | my $substring = substr( $line, $match_start, $match_length ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 111 | my $substitution = Term::ANSIColor::colored( $substring, $ENV{ACK_COLOR_MATCH} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | # Fourth argument replaces the string specified by the first three. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 111 | substr( $line, $match_start, $match_length, $substitution ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | # Move the offset of where /g left off forward the number of spaces of highlighting. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 111 | pos($line) = $match_end + (length( $substitution ) - length( $substring )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 111 | $highlighted = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | # Reset formatting and delete everything to the end of the line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 119 | ▶ | $line .= "\e[0m\e[K" if $highlighted; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 7355 | push @line_parts, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 7355 | App::Ack::say( join( $separator, @line_parts ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | # Print the underline, if appropriate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 7355 | ▶ | if ( $underline ne '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | # Figure out how many spaces are used per line for the ANSI coloring. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | state $chars_used_by_coloring; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | if ( !defined($chars_used_by_coloring) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | $chars_used_by_coloring = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | ▶ | if ( $opt_color ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 0 | ▶ | my $len_fn = sub { length( Term::ANSIColor::colored( 'x', $ENV{$_[0]} ) ) - 1 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | ▶ | $chars_used_by_coloring += $len_fn->('ACK_COLOR_FILENAME') unless $opt_heading; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | $chars_used_by_coloring += $len_fn->('ACK_COLOR_LINENO'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | ▶ | $chars_used_by_coloring += $len_fn->('ACK_COLOR_COLNO') if $opt_column; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | pop @line_parts; # Leave only the stuff on the left. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | ▶ | if ( @line_parts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | my $stuff_on_the_left = join( $separator, @line_parts ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | my $spaces_needed = length($stuff_on_the_left) - $chars_used_by_coloring + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | App::Ack::print( ' ' x $spaces_needed ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | App::Ack::say( $underline ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 7373 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 116 | ▶ | sub print_line_with_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_line_with_context: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 116 | my ( $filename, $matching_line, $lineno ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 116 | $matching_line =~ s/[\r\n]+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | # Check if we need to print context lines first. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 116 | ▶ | if ( $opt_A || $opt_B ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$main::opt_A or $main::opt_B
MC/DC100%2/2
$main::opt_A or $main::opt_B
$main::opt_A
$main::opt_B
Truth table100%3/3
A or B
A= $main::opt_AB= $main::opt_B
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 66 | my $before_unprinted = $lineno - $printed_lineno - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 66 | ▶ | if ( !$is_first_match && ( !$printed_lineno || $before_unprinted > $n_before_ctx_lines ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not $is_first_match and !$printed_lineno || $before_unprinted > $n_before_ctx_lines
not $printed_lineno or $before_unprinted > $n_before_ctx_lines
MC/DC100%3/3
not $is_first_match and !$printed_lineno || $before_unprinted > $n_before_ctx_lines
not $is_first_match
not $printed_lineno
$before_unprinted > $n_before_ctx_lines
Truth table100%4/4
not(A) and not(B) or C
A= not $is_first_matchB= not $printed_linenoC= $before_unprinted > $n_before_ctx_lines
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 7 | App::Ack::say( '--' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | # We want at most $n_before_ctx_lines of context. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 66 | ▶ | if ( $before_unprinted > $n_before_ctx_lines ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 18 | $before_unprinted = $n_before_ctx_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 66 | ▶ | while ( $before_unprinted > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 25 | my $line = $before_context_buf[($before_context_pos - $before_unprinted + $n_before_ctx_lines) % $n_before_ctx_lines]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 25 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | # Disable $opt->{column} since there are no matches in the context lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 25 | local $opt_column = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 25 | print_line_with_options( $filename, $line, $lineno-$before_unprinted, '-' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 25 | $before_unprinted--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 116 | print_line_with_options( $filename, $matching_line, $lineno, ':' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | # We want to get the next $n_after_ctx_lines printed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 116 | $after_context_pending = $n_after_ctx_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 116 | $is_first_match = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 116 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | ▶ | sub get_match_colno { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_match_colno: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 5 | return $match_colno; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 1471 | ▶ | sub count_matches_in_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count_matches_in_file: called CC=26 SCAR=48.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 1471 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 1471 | my $bail = shift; # True if we're just checking for existence. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 1471 | my $nmatches = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 1471 | my $do_scan = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 1471 | ▶ | if ( !$file->open() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 1 | $do_scan = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 1 | ▶ | if ( $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 1 | App::Ack::warn( $file->name . ": $!" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 1470 | ▶ | if ( !$opt_v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 1470 | ▶ | if ( !$file->may_be_present( $re_scan ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 1182 | $do_scan = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 1471 | ▶ | if ( $do_scan ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 288 | $file->reset(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 288 | my $in_range = range_setup(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 288 | my $fh = $file->{fh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 288 | ▶ | if ( $using_ranges ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | ▶ | while ( <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | ▶ | $in_range = 1 if ( !$in_range && defined($opt_range_start) && /$opt_range_start/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
not $in_range and defined $main::opt_range_start
MC/DC0%0/3
not $in_range and defined $main::opt_range_start and /$main::opt_range_start/o
not $in_range
defined $main::opt_range_start
/$main::opt_range_start/o
Truth table0%0/4
not(A) and B and C
A= not $in_rangeB= defined $main::opt_range_startC= /$main::opt_range_start/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | if ( $in_range ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | my $is_match = /$re_match/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | if ( $is_match && defined($re_not) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$is_match and defined $main::re_not
MC/DC0%0/2
$is_match and defined $main::re_not
$is_match
defined $main::re_not
Truth table0%0/3
A and B
A= $is_matchB= defined $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | $is_match = !/$re_not/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | ▶ | if ( $is_match xor $opt_v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$is_match xor $main::opt_v
MC/DC0%0/2
$is_match xor $main::opt_v
$is_match
$main::opt_v
Truth table0%0/4
A xor B
A= $is_matchB= $main::opt_v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ++$nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | ▶ | last if $bail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | ▶ | $in_range = 0 if ( $in_range && defined($opt_range_end) && /$opt_range_end/o ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$in_range and defined $main::opt_range_end
MC/DC0%0/3
$in_range and defined $main::opt_range_end and /$main::opt_range_end/o
$in_range
defined $main::opt_range_end
/$main::opt_range_end/o
Truth table0%0/4
A and B and C
A= $in_rangeB= defined $main::opt_range_endC= /$main::opt_range_end/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 288 | ▶ | while ( <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 8415 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 8415 | my $is_match = /$re_match/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 8415 | ▶ | if ( $is_match && defined($re_not) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$is_match and defined $main::re_not
MC/DC0%0/2
$is_match and defined $main::re_not
$is_match
defined $main::re_not
Truth table66%2/3
A and B
A= $is_matchB= defined $main::re_not
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | $is_match = !/$re_not/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 8415 | ▶ | if ( $is_match xor $opt_v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$is_match xor $main::opt_v
MC/DC50%1/2
$is_match xor $main::opt_v
$is_match
$main::opt_v
Truth table50%2/4
A xor B
A= $is_matchB= $main::opt_v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 640 | ++$nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 640 | ▶ | last if $bail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 1471 | $file->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 1471 | return $nmatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 871 | ▶ | sub range_setup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_setup: called CC=3 SCAR=13.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 871 | ▶ | return !$using_ranges || (!$opt_range_start && $opt_range_end); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
!$main::using_ranges || !$main::opt_range_start && $main::opt_range_end
not $main::opt_range_start and $main::opt_range_end
MC/DC33%1/3
!$main::using_ranges || !$main::opt_range_start && $main::opt_range_end
!$main::using_ranges
not $main::opt_range_start
$main::opt_range_end
Truth table50%2/4
not(A) || not(B) and C
A= !$main::using_rangesB= not $main::opt_range_startC= $main::opt_range_end
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | ack - grep-like text finder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | ack [options] PATTERN [FILE...] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | ack -f [options] [DIRECTORY...] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | ack is designed as an alternative to F<grep> for programmers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | ack searches the named input FILEs or DIRECTORYs for lines containing a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | match to the given PATTERN. By default, ack prints the matching lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | If no FILE or DIRECTORY is given, the current directory will be searched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | PATTERN is a Perl regular expression. Perl regular expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | are commonly found in other programming languages, but for the particulars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | of their behavior, please consult | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | L<perlreref|https://perldoc.perl.org/perlreref.html>. If you don't know | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | how to use regular expression but are interested in learning, you may | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | consult L<perlretut|https://perldoc.perl.org/perlretut.html>. If you do not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | need or want ack to use regular expressions, please see the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | C<-Q>/C<--literal> option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | Ack can also list files that would be searched, without actually | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | searching them, to let you take advantage of ack's file-type filtering | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | capabilities. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | =head1 FILE SELECTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | If files are not specified for searching, either on the command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | line or piped in with the C<-x> option, I<ack> delves into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | subdirectories selecting files for searching. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | I<ack> is intelligent about the files it searches. It knows about | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | certain file types, based on both the extension on the file and, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | in some cases, the contents of the file. These selections can be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | made with the B<--type> option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | With no file selection, I<ack> searches through regular files that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | are not explicitly excluded by B<--ignore-dir> and B<--ignore-file> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | options, either present in F<ackrc> files or on the command line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | The default options for I<ack> ignore certain files and directories. These | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | include: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | =item * Backup files: Files matching F<#*#> or ending with F<~>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | =item * Coredumps: Files matching F<core.\d+> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | =item * Version control directories like F<.svn> and F<.git>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | Run I<ack> with the C<--dump> option to see what settings are set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | However, I<ack> always searches the files given on the command line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | no matter what type. If you tell I<ack> to search in a coredump, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | it will search in a coredump. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | =head1 DIRECTORY SELECTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | I<ack> descends through the directory tree of the starting directories | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | specified. If no directories are specified, the current working directory is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | used. However, it will ignore the shadow directories used by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | many version control systems, and the build directories used by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | Perl MakeMaker system. You may add or remove a directory from this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | list with the B<--[no]ignore-dir> option. The option may be repeated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | to add/remove multiple directories from the ignore list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | For a complete list of directories that do not get searched, run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | C<ack --dump>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | =head1 MATCHING IN A RANGE OF LINES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | The C<--range-start> and C<--range-end> options let you specify ranges of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | lines to search within each file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | Say you had the following file, called F<testfile>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | # This function calls print on "foo". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | sub foo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | print 'foo'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | my $print = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | sub bar { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | print 'bar'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | my $task = 'print'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | Calling C<ack print> will give us five matches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | $ ack print testfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | # This function calls print on "foo". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | print 'foo'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | my $print = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | print 'bar'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | my $task = 'print'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | What if we only want to search for C<print> within the subroutines? We can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | specify ranges of lines that we want ack to search. The range starts with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | any line that matches the pattern C<^sub \w+>, and stops with any line that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | matches C<^}>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | $ ack --range-start='^sub \w+' --range-end='^}' print testfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | print 'foo'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | print 'bar'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | Note that ack searched two ranges of lines. The listing below shows which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | lines were in a range and which were out of the range. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | Out # This function calls print on "foo". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | In sub foo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | In print 'foo'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | In } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | Out my $print = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | In sub bar { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | In print 'bar'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | In } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | Out my $task = 'print'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | You don't have to specify both C<--range-start> and C<--range-end>. IF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | C<--range-start> is omitted, then the range runs from the first line in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | file until the first line that matches C<--range-end>. Similarly, if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | C<--range-end> is omitted, the range runs from the first line matching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | C<--range-start> to the end of the file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | For example, if you wanted to search all HTML files up until the first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | instance of the C<< <body> >>, you could do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | ack foo --html --range-end='<body>' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | Or to search after Perl's `__DATA__` or `__END__` markers, you would do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | ack pattern --perl --range-start='^__(END|DATA)__' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | It's possible for a range to start and stop on the same line. For example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | --range-start='<title>' --range-end='</title>' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | would match this line as both the start and end of the range, making a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | one-line range. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | <title>Page title</title> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | Note that the patterns in C<--range-start> and C<--range-end> are not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | affected by options like C<-i>, C<-w> and C<-Q> that modify the behavior of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | the main pattern being matched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | Again, ranges only affect where matches are looked for. Everything else in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | ack works the same way. Using C<-c> option with a range will give a count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | of all the matches that appear within those ranges. The C<-l> shows those | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | files that have a match within a range, and the C<-L> option shows files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | that do not have a match within a range. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | The C<-v> option for negating a match works inside the range, too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | To see lines that don't match "google" within the "<head>" section of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | your HTML files, you could do: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | ack google -v --html --range-start='<head' --range-end='</head>' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | Specifying a range to search does not affect how matches are displayed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | The context for a match will still be the same, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | Using the context options work the same way, and will show context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | lines for matches even if the context lines fall outside the range. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | Similarly, C<--passthru> will show all lines in the file, but only show | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | matches for lines within the range. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | =head1 OPTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | =item B<--ackrc> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | Specifies an ackrc file to load after all others; see L</"ACKRC LOCATION SEMANTICS">. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | =item B<--and=PATTERN> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | Specifies a I<PATTERN> that MUST ALSO be found on a given line for a match to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | occur. This option can be repeated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | If you want to find all the lines with both "dogs" or "cats", use: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | ack dogs --and cats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | Note that the options that affect "dogs" also affect "cats", so if you have | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | ack -i -w dogs --and cats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | then the search for both "dogs" and "cats" will be case-insensitive and be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | word-limited. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | C<--and> cannot be used with C<--or>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | =item B<-A I<NUM>>, B<--after-context=I<NUM>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | Print I<NUM> lines of trailing context after matching lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | =item B<-B I<NUM>>, B<--before-context=I<NUM>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | Print I<NUM> lines of leading context before matching lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | =item B<--[no]break> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | Print a break between results from different files. On by default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | when used interactively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | =item B<-C [I<NUM>]>, B<--context[=I<NUM>]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | Print I<NUM> lines (default 2) of context around matching lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | You can specify zero lines of context to override another context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | specified in an ackrc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | =item B<-c>, B<--count> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | Suppress normal output; instead print a count of matching lines for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | each input file. If B<-l> is in effect, it will only show the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | number of lines for each file that has lines matching. Without | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | B<-l>, some line counts may be zeroes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | If combined with B<-h> (B<--no-filename>) ack outputs only one total | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | count. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | =item B<--[no]color>, B<--[no]colour> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | B<--color> highlights the matching text. B<--nocolor> suppresses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | the color. This is on by default unless the output is redirected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | On Windows, this option is off by default unless the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | L<Win32::Console::ANSI> module is installed or the C<ACK_PAGER_COLOR> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | environment variable is used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | =item B<--color-filename=I<color>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | Sets the color to be used for filenames. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | =item B<--color-match=I<color>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | Sets the color to be used for matches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | =item B<--color-colno=I<color>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | Sets the color to be used for column numbers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | =item B<--color-lineno=I<color>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | Sets the color to be used for line numbers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | =item B<--[no]column> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | Show the column number of the first match. This is helpful for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | editors that can place your cursor at a given position. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | =item B<--create-ackrc> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | Dumps the default ack options to standard output. This is useful for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | when you want to customize the defaults. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | =item B<--dump> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | Writes the list of options loaded and where they came from to standard | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | output. Handy for debugging. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | =item B<--[no]env> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | B<--noenv> disables all environment processing. No F<.ackrc> is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | read and all environment variables are ignored. By default, F<ack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | considers F<.ackrc> and settings in the environment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | =item B<--flush> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | B<--flush> flushes output immediately. This is off by default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | unless ack is running interactively (when output goes to a pipe or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | file). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | =item B<-f> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | Only print the files that would be searched, without actually doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | any searching. PATTERN must not be specified, or it will be taken | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | as a path to search. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | =item B<--files-from=I<FILE>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | The list of files to be searched is specified in I<FILE>. The list of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | files are separated by newlines. If I<FILE> is C<->, the list is loaded | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | from standard input. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | Note that the list of files is B<not> filtered in any way. If you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | add C<--type=html> in addition to C<--files-from>, the C<--type> will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | be ignored. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | =item B<--[no]filter> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | Forces ack to act as if it were receiving input via a pipe. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | =item B<--[no]follow> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | Follow or don't follow symlinks, other than whatever starting files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | or directories were specified on the command line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | This is off by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | =item B<-g I<PATTERN>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | Print searchable files where the relative path + filename matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | I<PATTERN>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | Note that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | ack -g foo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | is exactly the same as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | ack -f | ack foo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | This means that just as ack will not search, for example, F<.jpg> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | files, C<-g> will not list F<.jpg> files either. ack is not intended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | to be a general-purpose file finder. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | Note also that if you have C<-i> in your .ackrc that the filenames | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | to be matched will be case-insensitive as well. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | This option can be combined with B<--color> to make it easier to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | spot the match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | =item B<--[no]group> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | B<--group> groups matches by file name. This is the default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | when used interactively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | B<--nogroup> prints one result per line, like grep. This is the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | default when output is redirected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | =item B<-H>, B<--with-filename> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | Print the filename for each match. This is the default unless searching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | a single explicitly specified file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | =item B<-h>, B<--no-filename> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | Suppress the prefixing of filenames on output when multiple files are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | searched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | =item B<--[no]heading> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | Print a filename heading above each file's results. This is the default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | when used interactively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | =item B<--help> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | Print a short help statement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | =item B<--help-types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | Print all known types. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | =item B<--help-colors> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | Print a chart of various color combinations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | =item B<--help-rgb-colors> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | Like B<--help-colors> but with more precise RGB colors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | =item B<-i>, B<--ignore-case> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | Ignore case distinctions in PATTERN. Overrides B<--smart-case> and B<-I>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | =item B<-I>, B<--no-ignore-case> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | Turns on case distinctions in PATTERN. Overrides B<--smart-case> and B<-i>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | =item B<--ignore-ack-defaults> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | Tells ack to completely ignore the default definitions provided with ack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | This is useful in combination with B<--create-ackrc> if you I<really> want | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | to customize ack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | =item B<--[no]ignore-dir=I<DIRNAME>>, B<--[no]ignore-directory=I<DIRNAME>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | Ignore directory (as CVS, .svn, etc are ignored). May be used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | multiple times to ignore multiple directories. For example, mason | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | users may wish to include B<--ignore-dir=data>. The B<--noignore-dir> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | option allows users to search directories which would normally be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | ignored (perhaps to research the contents of F<.svn/props> directories). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | The I<DIRNAME> must always be a simple directory name. Nested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | directories like F<foo/bar> are NOT supported. You would need to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | specify B<--ignore-dir=foo> and then no files from any foo directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | are taken into account by ack unless given explicitly on the command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | =item B<--ignore-file=I<FILTER:ARGS>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | Ignore files matching I<FILTER:ARGS>. The filters are specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | identically to file type filters as seen in L</"Defining your own types">. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | =item B<-k>, B<--known-types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | Limit selected files to those with types that ack knows about. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | =item B<-l>, B<--files-with-matches> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | Only print the filenames of matching files, instead of the matching text. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | =item B<-L>, B<--files-without-matches> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | Only print the filenames of files that do I<NOT> match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | =item B<--match I<PATTERN>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | Specify the I<PATTERN> explicitly. This is helpful if you don't want to put the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | regex as your first argument, e.g. when executing multiple searches over the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | same set of files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | # search for foo and bar in given files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | ack file1 t/file* --match foo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | ack file1 t/file* --match bar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | =item B<-m=I<NUM>>, B<--max-count=I<NUM>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | Print only I<NUM> matches out of each file. If you want to stop ack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | after printing the first match of any kind, use the B<-1> options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | =item B<--man> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | Print this manual page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | =item B<-n>, B<--no-recurse> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | No descending into subdirectories. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | =item B<--not=PATTERN> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | Specifies a I<PATTERN> that must NOT be true on a given line for a match to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | occur. This option can be repeated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | If you want to find all the lines with "dogs" but not if "cats" or "fish" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | appear on the line, use: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | ack dogs --not cats --not fish | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | Note that the options that affect "dogs" also affect "cats" and "fish", so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | if you have | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | ack -i -w dogs --not cats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | then the search for both "dogs" and "cats" will be case-insensitive and be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | word-limited. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | =item B<-o> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | Show only the part of each line matching PATTERN (turns off text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | highlighting). This is exactly the same as C<--output=$&>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | =item B<--or=PATTERN> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | Specifies a I<PATTERN> that MAY be found on a given line for a match to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | occur. This option can be repeated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | If you want to find all the lines with "dogs" or "cats", use: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | ack dogs --or cats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | Note that the options that affect "dogs" also affect "cats", so if you have | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | ack -i -w dogs --or cats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | then the search for both "dogs" and "cats" will be case-insensitive and be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | word-limited. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | C<--or> cannot be used with C<--and>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | =item B<--output=I<expr>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | Output the evaluation of I<expr> for each line (turns off text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | highlighting). If PATTERN matches more than once then a line is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | output for each non-overlapping match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | I<expr> may contain the strings "\n", "\r" and "\t", which will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | expanded to their corresponding characters line feed, carriage return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | and tab, respectively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | I<expr> may also contain the following Perl special variables: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | =item C<$1> through C<$9> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | The subpattern from the corresponding set of capturing parentheses. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | If your pattern is C<(.+) and (.+)>, and the string is "this and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | that', then C<$1> is "this" and C<$2> is "that". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | =item C<$_> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | The contents of the line in the file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | =item C<$.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | The number of the line in the file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | =item C<$&>, C<$`> and C<$'> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | C<$&> is the string matched by the pattern, C<$`> is what | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | precedes the match, and C<$'> is what follows it. If the pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | is C<gra(ph|nd)> and the string is "lexicographic", then C<$&> is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | "graph", C<$`> is "lexico" and C<$'> is "ic". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | Use of these variables in your output will slow down the pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | matching. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | =item C<$+> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | The match made by the last parentheses that matched in the pattern. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | For example, if your pattern is C<Version: (.+)|Revision: (.+)>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | then C<$+> will contain whichever set of parentheses matched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | =item C<$f> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | C<$f> is available, in C<--output> only, to insert the filename. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | This is a stand-in for the discovered C<$filename> usage in old C<< ack2 --output >>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | which is disallowed with C<ack3> improved security. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | The intended usage is to provide the grep or compile-error syntax needed for editor/IDE go-to-line integration, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | e.g. C<--output=$f:$.:$_> or C<--output=$f\t$.\t$&> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | =item B<--pager=I<program>>, B<--nopager> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | B<--pager> directs ack's output through I<program>. This can also be specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | via the C<ACK_PAGER> and C<ACK_PAGER_COLOR> environment variables. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | Using --pager does not suppress grouping and coloring like piping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | output on the command-line does. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | B<--nopager> cancels any setting in F<~/.ackrc>, C<ACK_PAGER> or C<ACK_PAGER_COLOR>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | No output will be sent through a pager. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | =item B<--passthru> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | Prints all lines, whether or not they match the expression. Highlighting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | will still work, though, so it can be used to highlight matches while | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | still seeing the entire file, as in: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | # Watch a log file, and highlight a certain IP address. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | $ tail -f ~/access.log | ack --passthru 123.45.67.89 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | =item B<--print0> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | Only works in conjunction with B<-f>, B<-g>, B<-l> or B<-c>, options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | that only list filenames. The filenames are output separated with a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | null byte instead of the usual newline. This is helpful when dealing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | with filenames that contain whitespace, e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | # Remove all files of type HTML. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | ack -f --html --print0 | xargs -0 rm -f | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | =item B<-p[N]>, B<--proximate[=N]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | Groups together match lines that are within N lines of each other. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | This is useful for visually picking out matches that appear close | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | to other matches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | For example, if you got these results without the C<--proximate> option, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 15: First match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 18: Second match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 19: Third match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 37: Fourth match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | they would look like this with C<--proximate=1> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 15: First match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 18: Second match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 19: Third match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | 37: Fourth match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | and this with C<--proximate=3>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 15: First match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 18: Second match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 19: Third match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 37: Fourth match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | If N is omitted, N is set to 1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | =item B<-P> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | Negates the effect of the B<--proximate> option. Shortcut for B<--proximate=0>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | =item B<-Q>, B<--literal> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | Quote all metacharacters in PATTERN, it is treated as a literal. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | =item B<-r>, B<-R>, B<--recurse> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | Recurse into sub-directories. This is the default and just here for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | compatibility with grep. You can also use it for turning B<--no-recurse> off. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | =item B<--range-start=PATTERN>, B<--range-end=PATTERN> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | Specifies patterns that mark the start and end of a range. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | L<MATCHING IN A RANGE OF LINES> for details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | =item B<-s> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | Suppress error messages about nonexistent or unreadable files. This is taken | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | from fgrep. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | =item B<-S>, B<--[no]smart-case>, B<--no-smart-case> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | Ignore case in the search strings if PATTERN contains no uppercase | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | characters. This is similar to C<smartcase> in the vim text editor. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | The options overrides B<-i> and B<-I>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | B<-S> is a synonym for B<--smart-case>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | B<-i> always overrides this option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | =item B<--sort-files> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | Sorts the found files lexicographically. Use this if you want your file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | listings to be deterministic between runs of I<ack>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | =item B<--show-types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | Outputs the filetypes that ack associates with each file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | Works with B<-f> and B<-g> options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | =item B<-t TYPE>, B<--type=TYPE>, B<--TYPE> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | Specify the types of files to include in the search. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | TYPE is a filetype, like I<perl> or I<xml>. B<--type=perl> can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | also be specified as B<--perl>, although this is deprecated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | Type inclusions can be repeated and are ORed together. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | See I<ack --help-types> for a list of valid types. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | =item B<-T TYPE>, B<--type=noTYPE>, B<--noTYPE> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | Specifies the type of files to exclude from the search. B<--type=noperl> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | can be done as B<--noperl>, although this is deprecated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | If a file is of both type "foo" and "bar", specifying both B<--type=foo> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | and B<--type=nobar> will exclude the file, because an exclusion takes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | precedence over an inclusion. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | =item B<--type-add I<TYPE>:I<FILTER>:I<ARGS>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | Files with the given ARGS applied to the given FILTER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | are recognized as being of (the existing) type TYPE. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | See also L</"Defining your own types">. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | =item B<--type-set I<TYPE>:I<FILTER>:I<ARGS>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | Files with the given ARGS applied to the given FILTER are recognized as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | being of type TYPE. This replaces an existing definition for type TYPE. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | also L</"Defining your own types">. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | =item B<--type-del I<TYPE>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | The filters associated with TYPE are removed from Ack, and are no longer considered | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | for searches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | =item B<--[no]underline> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | Turns on underlining of matches, where "underlining" is printing a line of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | carets under the match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | $ ack -u foo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | peanuts.txt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 17: Come kick the football you fool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | ^^^ ^^^ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 623: Price per square foot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | ^^^ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | This is useful if you're dumping the results of an ack run into a text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | file or printer that doesn't support ANSI color codes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | The setting of underline does not affect highlighting of matches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | =item B<-v>, B<--invert-match> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | Invert match: select non-matching lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | =item B<--version> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | Display version and copyright information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | =item B<-w>, B<--word-regexp> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | Force PATTERN to match only whole words. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | =item B<-x> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | An abbreviation for B<--files-from=->. The list of files to search are read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | from standard input, with one line per file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | Note that the list of files is B<not> filtered in any way. If you add | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | C<--type=html> in addition to C<-x>, the C<--type> will be ignored. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | =item B<-1> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | Stops after reporting first match of any kind. This is different | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | from B<--max-count=1> or B<-m1>, where only one match per file is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | shown. Also, B<-1> works with B<-f> and B<-g>, where B<-m> does | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | =item B<--thpppt> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | Display the all-important Bill The Cat logo. Note that the exact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | spelling of B<--thpppppt> is not important. It's checked against | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | a regular expression. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | =item B<--bar> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | Check with the admiral for traps. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | =item B<--cathy> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | Chocolate, Chocolate, Chocolate! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | =head1 THE .ackrc FILE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | The F<.ackrc> file contains command-line options that are prepended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | to the command line before processing. Multiple options may live | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | on multiple lines. Lines beginning with a # are ignored. A F<.ackrc> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | might look like this: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | # Always sort the files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | --sort-files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | # Always color, even if piping to another program | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | --color | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | # Use "less -r" as my pager | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | --pager=less -r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | Note that arguments with spaces in them do not need to be quoted, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | as they are not interpreted by the shell. Basically, each I<line> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | in the F<.ackrc> file is interpreted as one element of C<@ARGV>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | F<ack> looks in several locations for F<.ackrc> files; the searching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | process is detailed in L</"ACKRC LOCATION SEMANTICS">. These | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | files are not considered if B<--noenv> is specified on the command line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | =head1 Defining your own types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | ack allows you to define your own types in addition to the predefined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | types. This is done with command line options that are best put into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | an F<.ackrc> file - then you do not have to define your types over and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | over again. In the following examples the options will always be shown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | on one command line so that they can be easily copy & pasted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | File types can be specified both with the I<--type=xxx> option, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | or the file type as an option itself. For example, if you create | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | a filetype of "cobol", you can specify I<--type=cobol> or simply | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | I<--cobol>. File types must be at least two characters long. This | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | is why the C language is I<--cc> and the R language is I<--rr>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | I<ack --perl foo> searches for foo in all perl files. I<ack --help-types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | tells you, that perl files are files ending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | in .pl, .pm, .pod or .t. So what if you would like to include .xs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | files as well when searching for --perl files? I<ack --type-add perl:ext:xs --perl foo> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | does this for you. B<--type-add> appends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | additional extensions to an existing type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | If you want to define a new type, or completely redefine an existing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | type, then use B<--type-set>. I<ack --type-set eiffel:ext:e,eiffel> defines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | the type I<eiffel> to include files with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | the extensions .e or .eiffel. So to search for all eiffel files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | containing the word Bertrand use I<ack --type-set eiffel:ext:e,eiffel --eiffel Bertrand>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | As usual, you can also write B<--type=eiffel> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | instead of B<--eiffel>. Negation also works, so B<--noeiffel> excludes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | all eiffel files from a search. Redefining also works: I<ack --type-set cc:ext:c,h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | and I<.xs> files no longer belong to the type I<cc>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | When defining your own types in the F<.ackrc> file you have to use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | the following: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | --type-set=eiffel:ext:e,eiffel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | or writing on separate lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | --type-set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | eiffel:ext:e,eiffel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | The following does B<NOT> work in the F<.ackrc> file: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | --type-set eiffel:ext:e,eiffel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | In order to see all currently defined types, use I<--help-types>, e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | I<ack --type-set backup:ext:bak --type-add perl:ext:perl --help-types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | In addition to filtering based on extension, ack offers additional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | filter types. The generic syntax is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | I<--type-set TYPE:FILTER:ARGS>; I<ARGS> depends on the value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | of I<FILTER>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | =item is:I<FILENAME> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | I<is> filters match the target filename exactly. It takes exactly one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | argument, which is the name of the file to match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | --type-set make:is:Makefile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | =item ext:I<EXTENSION>[,I<EXTENSION2>[,...]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | I<ext> filters match the extension of the target file against a list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | of extensions. No leading dot is needed for the extensions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | --type-set perl:ext:pl,pm,t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | =item match:I<PATTERN> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | I<match> filters match the target filename against a regular expression. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | The regular expression is made case-insensitive for the search. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | --type-set make:match:/(gnu)?makefile/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | =item firstlinematch:I<PATTERN> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | I<firstlinematch> matches the first line of the target file against a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | regular expression. Like I<match>, the regular expression is made | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | case insensitive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | --type-add perl:firstlinematch:/perl/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | =head1 ACK COLORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | ack allows customization of the colors it uses when presenting matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | onscreen. It uses the colors available in Perl's L<Term::ANSIColor> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | module, which provides the following listed values. Note that case does not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | matter when using these values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | There are four different colors ack uses: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | Aspect Option Env. variable Default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | -------- ----------------- ------------------ --------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | filename --color-filename ACK_COLOR_FILENAME bold green | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | match --color-match ACK_COLOR_MATCH black on_yellow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | line no. --color-lineno ACK_COLOR_LINENO bold yellow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | column no. --color-colno ACK_COLOR_COLNO bold yellow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | The column number column is only used if the column number is shown because | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | of the --column option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | Colors may be specified by command-line option, such as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | C<ack --color-filename='red on_white'>, or by setting an environment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | variable, such as C<ACK_COLOR_FILENAME='red on_white'>. Options for colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | can be set in your ACKRC file (See "THE .ackrc FILE"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | ack can understand the following colors for the foreground: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | black red green yellow blue magenta cyan white | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | The optional background color is specified by prepending "on_" to one of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | the foreground colors: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | on_black on_red on_green on_yellow on_blue on_magenta on_cyan on_white | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | Each of the foreground colors can be modified with the following | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | attributes, which may or may not be supported by your terminal: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | bold faint italic underline blink reverse concealed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | Any combinations of modifiers can be added to the foreground color. If your | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | terminal supports it, and you enjoy visual punishment, you can specify: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | ack --color-filename="blink italic underline bold red on_yellow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | For charts of the colors and what they look like, run C<ack --help-colors> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | and C<ack --help-rgb-colors>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | If the eight standard colors, in their bold, faint and unmodified states, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | aren't enough for you to choose from, you can also specify colors by their | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | RGB values. They are specified as "rgbXYZ" where X, Y, and Z are values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | between 0 and 5 giving the intensity of red, green and blue, respectively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | Therefore, "rgb500" is pure red, "rgb505" is purple, and so on. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | Background colors can be specified with the "on_" prefix prepended on an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | RGB color, so that "on_rgb505" would be a purple background. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | The modifier attributes of blink, italic, underscore and so on may or may | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | not work on the RGB colors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | For a chart of the 216 possible RGB colors, run C<ack --help-rgb-colors>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | =head1 ENVIRONMENT VARIABLES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | For commonly-used ack options, environment variables can make life | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | much easier. These variables are ignored if B<--noenv> is specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | on the command line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | =item ACKRC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | Specifies the location of the user's F<.ackrc> file. If this file doesn't | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | exist, F<ack> looks in the default location. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | =item ACK_COLOR_COLNO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | Color specification for the column number in ack's output. By default, the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | column number is not shown. You have to enable it with the B<--column> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | option. See the section "ack Colors" above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | =item ACK_COLOR_FILENAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | Color specification for the filename in ack's output. See the section "ack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | Colors" above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | =item ACK_COLOR_LINENO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | Color specification for the line number in ack's output. See the section | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | "ack Colors" above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | =item ACK_COLOR_MATCH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | Color specification for the matched text in ack's output. See the section | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | "ack Colors" above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | =item ACK_PAGER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | Specifies a pager program, such as C<more>, C<less> or C<most>, to which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | ack will send its output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | Using C<ACK_PAGER> does not suppress grouping and coloring like | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | piping output on the command-line does, except that on Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | ack will assume that C<ACK_PAGER> does not support color. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | C<ACK_PAGER_COLOR> overrides C<ACK_PAGER> if both are specified. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | =item ACK_PAGER_COLOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | Specifies a pager program that understands ANSI color sequences. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | Using C<ACK_PAGER_COLOR> does not suppress grouping and coloring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | like piping output on the command-line does. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | If you are not on Windows, you never need to use C<ACK_PAGER_COLOR>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | =head1 ACK & OTHER TOOLS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | =head2 Simple vim integration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | F<ack> integrates easily with the Vim text editor. Set this in your | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | F<.vimrc> to use F<ack> instead of F<grep>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | set grepprg=ack\ -k | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | That example uses C<-k> to search through only files of the types ack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | knows about, but you may use other default flags. Now you can search | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | with F<ack> and easily step through the results in Vim: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | :grep Dumper perllib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | =head2 Editor integration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | Many users have integrated ack into their preferred text editors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | For details and links, see L<https://beyondgrep.com/more-tools/>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | =head2 Shell and Return Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | For greater compatibility with I<grep>, I<ack> in normal use returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | shell return or exit code of 0 only if something is found and 1 if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | no match is found. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | (Shell exit code 1 is C<$?=256> in perl with C<system> or backticks.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | The I<grep> code 2 for errors is not used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | If C<-f> or C<-g> are specified, then 0 is returned if at least one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | file is found. If no files are found, then 1 is returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | =head1 DEBUGGING ACK PROBLEMS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | If ack gives you output you're not expecting, start with a few simple steps. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | =head2 Try it with B<--noenv> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | Your environment variables and F<.ackrc> may be doing things you're | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | not expecting, or forgotten you specified. Use B<--noenv> to ignore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | your environment and F<.ackrc>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | =head2 Use B<-f> to see what files have been selected for searching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | Ack's B<-f> was originally added as a debugging tool. If ack is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | not finding matches you think it should find, run F<ack -f> to see | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | what files have been selected. You can also add the C<--show-types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | options to show the type of each file selected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | =head2 Use B<--dump> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | This lists the ackrc files that are loaded and the options loaded | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | from them. You may be loading an F<.ackrc> file that you didn't know | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | you were loading. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | =head1 ACKRC LOCATION SEMANTICS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | Ack can load its configuration from many sources. The following list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | specifies the sources Ack looks for configuration files; each one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | that is found is loaded in the order specified here, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | each one overrides options set in any of the sources preceding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | it. (For example, if I set --sort-files in my user ackrc, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | --nosort-files on the command line, the command line takes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | precedence) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | Defaults are loaded from App::Ack::ConfigDefaults. This can be omitted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | using C<--ignore-ack-defaults>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | =item * Global ackrc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | Options are then loaded from the global ackrc. This is located at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | C</etc/ackrc> on Unix-like systems. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | Under Windows XP and earlier, the global ackrc is at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | C<C:\Documents and Settings\All Users\Application Data\ackrc> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | Under Windows Vista/7, the global ackrc is at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | C<C:\ProgramData\ackrc> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | The C<--noenv> option prevents all ackrc files from being loaded. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | =item * User ackrc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | Options are then loaded from the user's ackrc. This is located at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | C<$HOME/.ackrc> on Unix-like systems. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | Under Windows XP and earlier, the user's ackrc is at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | C<C:\Documents and Settings\$USER\Application Data\ackrc>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | Under Windows Vista/7, the user's ackrc is at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | C<C:\Users\$USER\AppData\Roaming\ackrc>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | If you want to load a different user-level ackrc, it may be specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | with the C<$ACKRC> environment variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | The C<--noenv> option prevents all ackrc files from being loaded. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | =item * Project ackrc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | Options are then loaded from the project ackrc. The project ackrc is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | the first ackrc file with the name C<.ackrc> or C<_ackrc>, first searching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | in the current directory, then the parent directory, then the grandparent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | directory, etc. This can be omitted using C<--noenv>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | =item * --ackrc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | The C<--ackrc> option may be included on the command line to specify an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | ackrc file that can override all others. It is consulted even if C<--noenv> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | is present. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | =item * Command line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | Options are then loaded from the command line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | =head1 BUGS & ENHANCEMENTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | ack is based at GitHub at L<https://github.com/beyondgrep/ack3> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | Please report any bugs or feature requests to the issues list at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | GitHub: L<https://github.com/beyondgrep/ack3/issues>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | Please include the operating system that you're using; the output of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | the command C<ack --version>; and any customizations in your F<.ackrc> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | you may have. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | To suggest enhancements, please submit an issue at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | L<https://github.com/beyondgrep/ack3/issues>. Also read the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | F<DEVELOPERS.md> file in the ack code repository. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | Also, feel free to discuss your issues on the ack mailing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | list at L<https://groups.google.com/group/ack-users>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | Support for and information about F<ack> can be found at: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | =item * The ack homepage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | L<https://beyondgrep.com/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | =item * Source repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | L<https://github.com/beyondgrep/ack3> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | =item * The ack issues list at GitHub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | L<https://github.com/beyondgrep/ack3/issues> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | =item * The ack announcements mailing list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | L<https://groups.google.com/group/ack-announcement> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | =item * The ack users' mailing list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | L<https://groups.google.com/group/ack-users> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | =item * The ack development mailing list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | L<https://groups.google.com/group/ack-users> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | =head1 COMMUNITY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | There are ack mailing lists and a Slack channel for ack. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | L<https://beyondgrep.com/community/> for details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | =head1 FAQ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | This is the Frequently Asked Questions list for ack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | =head2 Can I stop using grep now? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | Many people find I<ack> to be better than I<grep> as an everyday tool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | 99% of the time, but don't throw I<grep> away, because there are times | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | you'll still need it. For example, you might be looking through huge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | log files and not using regular expressions. In that case, I<grep> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | will probably perform better. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | =head2 Why isn't ack finding a match in (some file)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | First, take a look and see if ack is even looking at the file. ack is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | intelligent in what files it will search and which ones it won't, but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | sometimes that can be surprising. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | Use the C<-f> switch, with no regex, to see a list of files that ack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | will search for you. If your file doesn't show up in the list of files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | that C<ack -f> shows, then ack never looks in it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | =head2 Wouldn't it be great if F<ack> did search & replace? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | No, ack will always be read-only. Perl has a perfectly good way | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | to do search & replace in files, using the C<-i>, C<-p> and C<-n> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | switches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | You can certainly use ack to select your files to update. For | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | example, to change all "foo" to "bar" in all PHP files, you can do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | this from the Unix shell: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | $ perl -i -p -e's/foo/bar/g' $(ack -f --php) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | =head2 Can I make ack recognize F<.xyz> files? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | Yes! Please see L</"Defining your own types"> in the ack manual. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | =head2 Will you make ack recognize F<.xyz> files by default? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | We might, depending on how widely-used the file format is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | Submit an issue at in the GitHub issue queue at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | L<https://github.com/beyondgrep/ack3/issues>. Explain what the file format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | is, where we can find out more about it, and what you have been using | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | in your F<.ackrc> to support it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | Please do not bother creating a pull request. The code for filetypes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | is trivial compared to the rest of the process we go through. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | =head2 Why is it called ack if it's called ack-grep? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | The name of the program is "ack". Some packagers have called it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | "ack-grep" when creating packages because there's already a package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | out there called "ack" that has nothing to do with this ack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | I suggest you make a symlink named F<ack> that points to F<ack-grep> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | because one of the crucial benefits of ack is having a name that's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | so short and simple to type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | To do that, run this with F<sudo> or as root: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | ln -s /usr/bin/ack-grep /usr/bin/ack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | Alternatively, you could use a shell alias: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | # bash/zsh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2363 | alias ack=ack-grep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2365 | # csh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2366 | alias ack ack-grep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2368 | =head2 What does F<ack> mean? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2370 | Nothing. I wanted a name that was easy to type and that you could | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2371 | pronounce as a single syllable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2373 | =head2 Can I do multi-line regexes? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2375 | No, ack does not support regexes that match multiple lines. Doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2376 | so would require reading in the entire file at a time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2378 | If you want to see lines near your match, use the C<--A>, C<--B> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2379 | and C<--C> switches for displaying context. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2381 | =head2 Why is ack telling me I have an invalid option when searching for C<+foo>? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2383 | ack treats command line options beginning with C<+> or C<-> as options; if you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2384 | would like to search for these, you may prefix your search term with C<--> or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2385 | use the C<--match> option. (However, don't forget that C<+> is a regular | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2386 | expression metacharacter!) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2388 | =head2 Why does C<"ack '.{40000,}'"> fail? Isn't that a valid regex? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2390 | The Perl language limits the repetition quantifier to 32K. You | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2391 | can search for C<.{32767}> but not C<.{32768}>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2393 | =head2 Ack does "X" and shouldn't, should it? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2395 | We try to remain as close to grep's behavior as possible, so when in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2396 | doubt, see what grep does! If there's a mismatch in functionality there, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2397 | please submit an issue to GitHub, and/or bring it up on the ack-users | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2398 | mailing list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2400 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2402 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2404 | How appropriate to have I<ack>nowledgements! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2406 | Thanks to everyone who has contributed to ack in any way, including | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2407 | Dmitri Vereshchagin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2408 | Geraint Edwards, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2409 | Loren Howard, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2410 | Yaroslav Halchenko, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2411 | Thiago Perrotta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2412 | Thomas Gossler, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2413 | Kieran Mace, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2414 | Volker Glave, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2415 | Axel Beckert, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2416 | Eric Pement, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2417 | Gabor Szabo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2418 | Frieder Bluemle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2419 | Grzegorz Kaczmarczyk, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2420 | Dan Book, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2421 | Tomasz Konojacki, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2422 | Salomon Smeke, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2423 | M. Scott Ford, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2424 | Anders Eriksson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2425 | H.Merijn Brand, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2426 | Duke Leto, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2427 | Gerhard Poul, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2428 | Ethan Mallove, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2429 | Marek Kubica, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2430 | Ray Donnelly, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2431 | Nikolaj Schumacher, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2432 | Ed Avis, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2433 | Nick Morrott, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2434 | Austin Chamberlin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2435 | Varadinsky, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2436 | SE<eacute>bastien FeugE<egrave>re, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2437 | Jakub Wilk, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2438 | Pete Houston, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2439 | Stephen Thirlwall, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2440 | Jonah Bishop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2441 | Chris Rebert, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2442 | Denis Howe, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2443 | RaE<uacute>l GundE<iacute>n, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2444 | James McCoy, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2445 | Daniel Perrett, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2446 | Steven Lee, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2447 | Jonathan Perret, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2448 | Fraser Tweedale, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2449 | RaE<aacute>l GundE<aacute>n, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2450 | Steffen Jaeckel, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2451 | Stephan Hohe, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2452 | Michael Beijen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2453 | Alexandr Ciornii, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2454 | Christian Walde, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2455 | Charles Lee, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2456 | Joe McMahon, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2457 | John Warwick, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2458 | David Steinbrunner, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2459 | Kara Martens, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2460 | Volodymyr Medvid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2461 | Ron Savage, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2462 | Konrad Borowski, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2463 | Dale Sedivic, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2464 | Michael McClimon, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2465 | Andrew Black, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2466 | Ralph Bodenner, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2467 | Shaun Patterson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2468 | Ryan Olson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2469 | Shlomi Fish, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2470 | Karen Etheridge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2471 | Olivier Mengue, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2472 | Matthew Wild, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2473 | Scott Kyle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2474 | Nick Hooey, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2475 | Bo Borgerson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2476 | Mark Szymanski, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2477 | Marq Schneider, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2478 | Packy Anderson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2479 | JR Boyens, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2480 | Dan Sully, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2481 | Ryan Niebur, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2482 | Kent Fredric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2483 | Mike Morearty, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2484 | Ingmar Vanhassel, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2485 | Eric Van Dewoestine, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2486 | Sitaram Chamarty, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2487 | Adam James, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2488 | Richard Carlsson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2489 | Pedro Melo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2490 | AJ Schuster, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2491 | Phil Jackson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2492 | Michael Schwern, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2493 | Jan Dubois, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2494 | Christopher J. Madsen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2495 | Matthew Wickline, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2496 | David Dyck, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2497 | Jason Porritt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2498 | Jjgod Jiang, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2499 | Thomas Klausner, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2500 | Uri Guttman, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2501 | Peter Lewis, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2502 | Kevin Riggle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2503 | Ori Avtalion, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2504 | Torsten Blix, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2505 | Nigel Metheringham, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2506 | GE<aacute>bor SzabE<oacute>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2507 | Tod Hagan, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2508 | Michael Hendricks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2509 | E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2510 | Piers Cawley, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2511 | Stephen Steneker, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2512 | Elias Lutfallah, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2513 | Mark Leighton Fisher, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2514 | Matt Diephouse, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2515 | Christian Jaeger, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2516 | Bill Sully, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2517 | Bill Ricker, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2518 | David Golden, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2519 | Nilson Santos F. Jr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2520 | Elliot Shank, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2521 | Merijn Broeren, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2522 | Uwe Voelker, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2523 | Rick Scott, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2524 | Ask BjE<oslash>rn Hansen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2525 | Jerry Gay, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2526 | Will Coleda, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2527 | Mike O'Regan, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2528 | Slaven ReziE<0x107>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2529 | Mark Stosberg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2530 | David Alan Pisoni, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2531 | Adriano Ferreira, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2532 | James Keenan, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2533 | Leland Johnson, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2534 | Ricardo Signes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2535 | Pete Krawczyk and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2536 | Rob Hoelz. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2538 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2540 | Andy Lester, C<< <andy at petdance.com> >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2542 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2544 | Copyright 2005-2026 Andy Lester. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2546 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2547 | it under the terms of the Artistic License v2.0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2549 | See https://www.perlfoundation.org/artistic-license-20.html or the LICENSE.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2550 | file that comes with the ack distribution. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2552 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2554 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||