Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

incorporating lineno changes

  • Loading branch information...
commit 0d13da70a1ba33d307a25b9aecb40567abb0d274 2 parents bef9240 + 32ddf0d
@petdance petdance authored
View
11 Ack.pm
@@ -201,6 +201,7 @@ sub get_command_line_options {
'color|colour!' => \$opt{color},
'color-match=s' => \$ENV{ACK_COLOR_MATCH},
'color-filename=s' => \$ENV{ACK_COLOR_FILENAME},
+ 'color-lineno=s' => \$ENV{ACK_COLOR_LINENO},
'column!' => \$opt{column},
count => \$opt{count},
'env!' => sub { }, # ignore this option, it is handled beforehand
@@ -743,7 +744,8 @@ File presentation:
output is redirected, or on Windows)
--[no]colour Same as --[no]color
--color-filename=COLOR
- --color-match=COLOR Set the color for matches and filenames.
+ --color-match=COLOR
+ --color-lineno=COLOR Set the color for filenames, matches, and line numbers.
--flush Flush output immediately, even when ack is used
non-interactively (when output goes to a pipe or
file).
@@ -917,6 +919,7 @@ sub load_colors {
$ENV{ACK_COLOR_MATCH} ||= 'black on_yellow';
$ENV{ACK_COLOR_FILENAME} ||= 'bold green';
+ $ENV{ACK_COLOR_LINENO} ||= 'bold yellow';
return;
}
@@ -1146,7 +1149,11 @@ sub print_match_or_context {
if ( $show_filename ) {
App::Ack::print_filename($display_filename, $sep) if not $heading;
- App::Ack::print_line_no($line_no, $sep);
+ my $display_line_no =
+ $color
+ ? Term::ANSIColor::colored( $line_no, $ENV{ACK_COLOR_LINENO} )
+ : $line_no;
+ App::Ack::print_line_no($display_line_no, $sep);
}
if ( $output_func ) {
View
4 Changes
@@ -10,10 +10,14 @@ NEXT
Added docs for -r, -R, --recurse options.
+ Added new switch --color-lineno and environment variable ACK_COLOR_LINENO,
+ which allow setting the line number color. Thanks, Marq Schneider.
+
[DOCUMENTATION]
Clarified the documentation of --ignore-dir. Thanks, Torsten Blix.
+
1.92 Fri Dec 11 11:47:56 CST 2009
ack is now hosted at github: http://github.com/petdance/ack
View
24 ack
@@ -221,6 +221,10 @@ Sets the color to be used for filenames.
Sets the color to be used for matches.
+=item B<--color-lineno=I<color>>
+
+Sets the color to be used for line numbers.
+
=item B<--column>
Show the column number of the first match. This is helpful for editors
@@ -607,6 +611,15 @@ This option can also be set with B<--color-match>.
See B<ACK_COLOR_FILENAME> for the color specifications.
+=item ACK_COLOR_LINENO
+
+Specifies the color of the line number when printed in B<--color>
+mode. By default, it's "bold yellow".
+
+This option can also be set with B<--color-lineno>.
+
+See B<ACK_COLOR_FILENAME> for the color specifications.
+
=item ACK_PAGER
Specifies a pager program, such as C<more>, C<less> or C<most>, to which
@@ -1286,6 +1299,7 @@ sub get_command_line_options {
'color|colour!' => \$opt{color},
'color-match=s' => \$ENV{ACK_COLOR_MATCH},
'color-filename=s' => \$ENV{ACK_COLOR_FILENAME},
+ 'color-lineno=s' => \$ENV{ACK_COLOR_LINENO},
'column!' => \$opt{column},
count => \$opt{count},
'env!' => sub { }, # ignore this option, it is handled beforehand
@@ -1743,7 +1757,8 @@ File presentation:
output is redirected, or on Windows)
--[no]colour Same as --[no]color
--color-filename=COLOR
- --color-match=COLOR Set the color for matches and filenames.
+ --color-match=COLOR
+ --color-lineno=COLOR Set the color for filenames, matches, and line numbers.
--flush Flush output immediately, even when ack is used
non-interactively (when output goes to a pipe or
file).
@@ -1892,6 +1907,7 @@ sub load_colors {
$ENV{ACK_COLOR_MATCH} ||= 'black on_yellow';
$ENV{ACK_COLOR_FILENAME} ||= 'bold green';
+ $ENV{ACK_COLOR_LINENO} ||= 'bold yellow';
return;
}
@@ -2104,7 +2120,11 @@ sub print_match_or_context {
if ( $show_filename ) {
App::Ack::print_filename($display_filename, $sep) if not $heading;
- App::Ack::print_line_no($line_no, $sep);
+ my $display_line_no =
+ $color
+ ? Term::ANSIColor::colored( $line_no, $ENV{ACK_COLOR_LINENO} )
+ : $line_no;
+ App::Ack::print_line_no($display_line_no, $sep);
}
if ( $output_func ) {
View
13 ack-base
@@ -213,6 +213,10 @@ Sets the color to be used for filenames.
Sets the color to be used for matches.
+=item B<--color-lineno=I<color>>
+
+Sets the color to be used for line numbers.
+
=item B<--column>
Show the column number of the first match. This is helpful for editors
@@ -599,6 +603,15 @@ This option can also be set with B<--color-match>.
See B<ACK_COLOR_FILENAME> for the color specifications.
+=item ACK_COLOR_LINENO
+
+Specifies the color of the line number when printed in B<--color>
+mode. By default, it's "bold yellow".
+
+This option can also be set with B<--color-lineno>.
+
+See B<ACK_COLOR_FILENAME> for the color specifications.
+
=item ACK_PAGER
Specifies a pager program, such as C<more>, C<less> or C<most>, to which
View
3  ack-help.txt
@@ -66,7 +66,8 @@ File presentation:
output is redirected, or on Windows)
--[no]colour Same as --[no]color
--color-filename=COLOR
- --color-match=COLOR Set the color for matches and filenames.
+ --color-match=COLOR
+ --color-lineno=COLOR Set the color for filenames, matches, and line numbers.
--flush Flush output immediately, even when ack is used
non-interactively (when output goes to a pipe or
file).
View
2  btg/index.php
@@ -241,7 +241,7 @@
(function() {
var ga = document.createElement('script');
-ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
Please sign in to comment.
Something went wrong with that request. Please try again.