From fcca0119850789e7ba88fc7f4fba02adaf3b9288 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 7 Sep 2019 04:41:55 +0200 Subject: [PATCH] minimum limit to override start line number Internal option --hidemin or by negative -L instead of maximum. --- barcat | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/barcat b/barcat index d12baf6..c4244d4 100755 --- a/barcat +++ b/barcat @@ -29,7 +29,10 @@ GetOptions(\%opt, $opt{trim} = $optval; }, 'value-length=i', - 'hidemax|limit|L=i', + 'hidemin=i', + 'hidemax|limit|L=i' => sub { + $opt{$_[1] < 0 ? 'hidemin' : 'hidemax'} = abs $_[1]; + }, 'markers|m=s', 'unmodified|u!', 'width|w=i', @@ -76,7 +79,7 @@ $SIG{INT} = 'DEFAULT'; sub show_lines { -state $nr = 0; +state $nr = $opt{hidemin} ? $opt{hidemin} - 1 : 0; @lines and @lines > $nr or return; my @order = sort { $b <=> $a } grep { length } @values; @@ -187,7 +190,7 @@ unless C<--length=0>. Prepend a dash (i.e. make negative) to enforce padding regardless of encountered contents. -=item -L, --limit= +=item -L, --limit=[-] Stop output after a number of lines. All input is still counted and analyzed for statistics, -- 2.30.0