From 0c2910e15aa1fb6a9a6d2cce1840202c14ec7a57 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 8 Jun 2016 23:16:58 +0200 Subject: db-iris: indicate canceled stops with an exclamation mark when -oc is inactive --- bin/db-iris | 26 ++++++++++++++++++++------ 1 file 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 will try to find station names similar to I. -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 -- cgit v1.2.3