summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-06-08 23:16:58 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-06-08 23:16:58 +0200
commit0c2910e15aa1fb6a9a6d2cce1840202c14ec7a57 (patch)
treea29ab4bcf96f01b79d4bbbf2e51031ee54550202
parent995035c5796397e49c2819e7e9f1efd7a5c0a4bc (diff)
db-iris: indicate canceled stops with an exclamation mark when -oc is inactive
-rwxr-xr-xbin/db-iris26
1 files changed, 20 insertions, 6 deletions
diff --git a/bin/db-iris b/bin/db-iris
index 528663e..526129c 100755
--- a/bin/db-iris
+++ b/bin/db-iris
@@ -244,18 +244,33 @@ sub display_result {
die("Nothing to show\n");
}
+ # the " !" suffixes might change a column's maximum line length, so we
+ # need to add them before calculating it
+ for my $line (@lines) {
+ my $d = $line->[5];
+
+ if ( not $edata{canceled} and $d->canceled_stops ) {
+ $line->[3] .= q{ !};
+ }
+
+ if ( ( $d->platform // q{} ) ne ( $d->sched_platform // q{} ) ) {
+ $line->[4] .= q{ !};
+ }
+ }
+
for my $i ( 0 .. 4 ) {
$line_length[$i] = max map { length( $_->[$i] ) } @lines;
}
for my $line (@lines) {
+
+ my $d = $line->[5];
+
printf(
join( q{ }, ( map { "%-${_}s" } @line_length ) ),
@{$line}[ 0 .. 4 ]
);
- my $d = $line->[5];
-
if ( $edata{delays}
and $d->delay_messages )
{
@@ -388,9 +403,6 @@ for my $d ( $status->results() ) {
my $delay = format_delay($d);
my $platformstr = $d->platform // q{};
- if ( ( $d->platform // q{} ) ne ( $d->sched_platform // q{} ) ) {
- $platformstr .= ' !';
- }
my $timestr;
if ($track_via) {
$timestr = get_departure( $d, '%H:%M' ) || get_arrival( $d, '%H:%M' );
@@ -507,7 +519,9 @@ either a DS100 station code (such as "EE"), a normal station name
number (such as 8000098). If no exact match is found, B<db-iris> will try to
find station names similar to I<station>.
-An exclamation mark (C<< ! >>) next to a platform indicates that it is not the
+An exclamation mark (C<< ! >>) next to a destination indicates that at least
+one stop on the train's route has been canceled. Use B<-oc> to see the canceled
+stops. An exclamation mark next to a platform indicates that it is not the
scheduled one.
=head1 OPTIONS