From ba4406a60d218341b89196f2466459e4b2384996 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 7 Sep 2019 05:14:43 +0200 Subject: [PATCH] combined limit minimum-maximum --- barcat | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/barcat b/barcat index c4244d4..a69bbe5 100755 --- a/barcat +++ b/barcat @@ -30,8 +30,15 @@ GetOptions(\%opt, }, 'value-length=i', 'hidemin=i', - 'hidemax|limit|L=i' => sub { - $opt{$_[1] < 0 ? 'hidemin' : 'hidemax'} = abs $_[1]; + 'hidemax=i', + 'limit|L=s' => sub { + my ($optname, $optval) = @_; + $optval ||= 0; + ($opt{hidemin}, $opt{hidemax}) = + $optval =~ m/\A (?: ([0-9]+)? - )? ([0-9]+)? \z/x or die( + "Value \"$optval\" invalid for option limit", + " (range expected)\n" + ); }, 'markers|m=s', 'unmodified|u!', @@ -190,7 +197,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