Skip to content

add B<--nolinenumber> #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ack
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ our $opt_regex;
our $opt_show_filename;
our $opt_show_types;
our $opt_underline;
our $opt_nolinenumber;
our $opt_v;

# Flag if we need any context tracking.
Expand Down Expand Up @@ -158,6 +159,7 @@ MAIN: {
$opt_show_filename = $opt->{show_filename};
$opt_show_types = $opt->{show_types};
$opt_underline = $opt->{underline};
$opt_nolinenumber = $opt->{nolinenumber};
$opt_v = $opt->{v};

if ( $opt_show_types && not( $opt_f || $opt_g ) ) {
Expand Down Expand Up @@ -915,13 +917,19 @@ sub print_line_with_options {
$disp_lineno = $lineno;
}

if ( $opt_nolinenumber ) {
$disp_lineno = "";
$separator="";
}

if ( $opt_heading ) {
push @line_parts, $disp_lineno;
}
else {
push @line_parts, $disp_filename, $disp_lineno;
}


if ( $opt_column ) {
my $colno = get_match_colno();
$colno = Term::ANSIColor::colored( $colno, $ENV{ACK_COLOR_COLNO} ) if $opt_color;
Expand Down Expand Up @@ -1813,6 +1821,10 @@ also L</"Defining your own types">.
The filters associated with TYPE are removed from Ack, and are no longer considered
for searches.

=item B<--nolinenumber>

disable line number

=item B<--[no]underline>

Turns on underlining of matches, where "underlining" is printing a line of
Expand Down
1 change: 1 addition & 0 deletions lib/App/Ack/ConfigLoader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ sub get_arg_spec {
't|type=s' => \&_type_handler,
'T=s' => sub { my ($getopt,$value) = @_; $value="no$value"; _type_handler($getopt,$value); },
'underline!' => \$opt->{underline},
'nolinenumber!' => \$opt->{nolinenumber},
'v|invert-match' => \$opt->{v},
'w|word-regexp' => \$opt->{w},
'x' => sub { $opt->{files_from} = '-' },
Expand Down