summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-06-19 11:52:29 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-06-19 11:52:29 +0200
commit4d7dacf51d7ebc8928ef2fa432f05d878d370430 (patch)
tree4fcf91d9a1c9b0eaf5d4b48cf4d77c210d5997e7
parent36218328fbb8eccbef2d10852676b8f086704626 (diff)
minor code cleanup
-rwxr-xr-xbin/icli20
1 files changed, 10 insertions, 10 deletions
diff --git a/bin/icli b/bin/icli
index cda0319..220d0be 100755
--- a/bin/icli
+++ b/bin/icli
@@ -115,14 +115,14 @@ sub parse_duration {
my %factors = (
s => 1,
m => 60,
- h => 3600,
- d => 86400,
- w => 604800,
+ h => 3_600,
+ d => 86_400,
+ w => 604_800,
);
$raw =~ m{ ^ (?<value> [.0-9]+ ) \s* (?<unit> [mhdw] )? $ }x
or die(
-"Cannot parse '$raw' - must be a number with an optional unit (s/m/h/d/w)"
+"Cannot parse '$raw' - must be a duration like '50s', '2m', '10h' or '1d'"
);
if ( $+{unit} ) {
@@ -199,7 +199,7 @@ sub split_by_words {
)
{
if ($tr_space) {
- $cur_str .= ' ';
+ $cur_str .= q{ };
}
else {
$tr_space = 1;
@@ -207,7 +207,7 @@ sub split_by_words {
$cur_str .= shift(@words);
}
if (@ret) {
- $cur_str = ( ' ' x $padding ) . $cur_str;
+ $cur_str = ( q{ } x $padding ) . $cur_str;
}
push( @ret, $cur_str );
}
@@ -688,7 +688,7 @@ sub display_downtime {
printf( '%-17.17s',
$d->{'fixed'}
? ' Fixed'
- : ' ' . pretty_duration_abs( $d->{duration} ) );
+ : q{ } . pretty_duration_abs( $d->{duration} ) );
}
if ( $v >= 2 ) {
print( $d->{comment} );
@@ -870,7 +870,7 @@ sub display_service {
$n_width += 4;
}
- print ' ';
+ print q{ };
print break_str( $s->{plugin_output}, $n_width );
@@ -1184,7 +1184,7 @@ elsif ( $list_type eq 'q' ) {
}
elsif ( $list_type eq 'd' ) {
if ( exists $data->{hostdowntimes} ) {
- say "Host downtimes:";
+ say 'Host downtimes:';
if ( $verbosity == 1 ) {
printf( "%-25.25s %-20.20s %-20.20s\n", 'Host', 'start', 'stop' );
}
@@ -1197,7 +1197,7 @@ elsif ( $list_type eq 'd' ) {
}
}
else {
- say "No host downtimes";
+ say 'No host downtimes';
}
if ( exists $data->{servicedowntimes} ) {
say "\nService downtimes:";