commit cadfdffc0a348b70981acd57ea7139d47e431446
parent 6afd1659f5dd4d114a81f20544524f9d3ea4e885
Author: René Wagner <rwa@clttr.info>
Date: Tue, 27 Dec 2022 21:27:23 +0100
improve -W param handling
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/phosta b/phosta
@@ -104,10 +104,10 @@ sub getconfig
sub writeconfig
{
- open(my $filehandle, '>', $configfile) or die "Could not open file '$configfile': $!";
- say $filehandle '$opt_D="'. $opt_D .'";';
- say $filehandle '$opt_E="'. $opt_E .'";';
- say $filehandle '$opt_W="'. $opt_W .'";';
+ open(my $filehandle, '>', $configfile) or die "Could not open file '$configfile': $!";
+ say $filehandle '$opt_D="'. $opt_D .'";';
+ say $filehandle '$opt_E="'. $opt_E .'";';
+ if ($opt_W != -1) { say $filehandle '$opt_W="'. $opt_W .'";'; }
say $filehandle '$opt_T="'. $opt_T .'";';
close $filehandle;
}
@@ -430,7 +430,7 @@ sub result_to_table
{
my ( $headers, $rows, $sum, $skippedlines ) = @_;
- my $tb = Text::SimpleTable::AutoWidth->new('max_width' => $opt_W);
+ my $tb = Text::SimpleTable::AutoWidth->new();
$tb->captions($headers);
foreach (@$rows)
@@ -487,7 +487,8 @@ sub main::HELP_MESSAGE
say ' -r : sort in reverse (ascending) order, default is descending order';
say ' -e : skip lines with empty selected or grouping fields';
say ' -W <number> : define max char width of output, default: 80, a minimum of 50 is required for meaningful output';
- say ' -T <value> : show results as always as a table (on) or not (off) or auto (chart when single field is selected), default is auto';
+ say ' -1 deletes the current setting';
+ say ' -T <value> : show results as always as a table (on) or not (off) or auto (chart when single field is selected), default is auto';
say ' allowed values: auto, on, off';
say '';
say 'examples:';