summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
754ddc0)
Shorthand to facilitate relative sizes without manual preparation.
Allow strings so trailing % can be accepted.
require Pod::Usage;
Pod::Usage::pod2usage(-exitval => 0, -perldocopt => '-oman', @_);
}
require Pod::Usage;
Pod::Usage::pod2usage(-exitval => 0, -perldocopt => '-oman', @_);
}
+my %opt;
+GetOptions(\%opt,
'color|c!',
'follow|f:i',
'color|c!',
'follow|f:i',
+ 'trim|length|l=s' => sub {
+ my ($optname, $optval) = @_;
+ $optval =~ s/%$// and $opt{trimpct}++;
+ $optval =~ m/^-?[0-9]+$/ or die(
+ "Value \"$optval\" invalid for option $optname",
+ " (number or percentage expected)\n"
+ );
+ $opt{trim} = $optval;
+ },
'markers|m=s',
'unmodified|u!',
'width|w=i',
'markers|m=s',
'unmodified|u!',
'width|w=i',
$opt{width} ||= $ENV{COLUMNS} || 80;
$opt{color} //= -t *STDOUT; # enable on tty
$opt{width} ||= $ENV{COLUMNS} || 80;
$opt{color} //= -t *STDOUT; # enable on tty
+$opt{trim} *= $opt{width} / 100 if $opt{trimpct};
if (defined $opt{follow}) {
$opt{follow} ||= 1;
if (defined $opt{follow}) {
$opt{follow} ||= 1;
Interval to output partial progress.
Interval to output partial progress.
-=item -l, --length=[-]<size>
+=item -l, --length=[-]<size>[%]
Trim line contents (between number and bars)
to a maximum number of characters.
Trim line contents (between number and bars)
to a maximum number of characters.