From 4520981dde8d12a18632b598f1c02a6649cde9f3 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 10 Nov 2023 22:23:09 +0100 Subject: hafas: show lines at a glance; show messages (todo: verbosity setting) --- bin/hafas | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/hafas b/bin/hafas index 2ad37e2..0d89c9f 100755 --- a/bin/hafas +++ b/bin/hafas @@ -249,10 +249,18 @@ if ($json_output) { } for my $res ( @{ $hafas->{results} } ) { + + #if ($res->is_cancelled) { + # say "# cancelled\n"; + #} + + my $glance = join( ' - ', + map { $_->name } grep { $_->type eq 'JNY' } $res->sections ); + printf( - "# %02d:%02d %s\n", + "# %02d:%02d %s %s\n", $res->duration->in_units( 'hours', 'minutes' ), - display_occupancies( $res->load ) + display_occupancies( $res->load ), $glance ); for my $msg ( $res->messages ) { if ( $msg->short ) { @@ -260,6 +268,7 @@ for my $res ( @{ $hafas->{results} } ) { } printf( "# %s\n", $msg->text ); } + say q{}; my $have_delay = 0; @@ -292,6 +301,18 @@ for my $res ( @{ $hafas->{results} } ) { else { printf("\n???\n"); } + for my $msg ( $sec->messages ) { + if ( $msg->code eq 'text.connection.section.arrival.date.deviation' + or $msg->code eq + 'text.connection.section.departure.date.deviation' ) + { + next; + } + if ( $msg->short ) { + printf( "# %s\n", $msg->short ); + } + printf( "# %s\n", $msg->text ); + } say q{}; } printf( "\n%s\n\n", q{-} x 40 ); -- cgit v1.2.3