summaryrefslogtreecommitdiff
path: root/bin/hafas
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-10 22:23:09 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-10 22:23:09 +0100
commit4520981dde8d12a18632b598f1c02a6649cde9f3 (patch)
treec1674e95e405bad39ba847a17edf5ba90a068bac /bin/hafas
parent83eeb9fcdd0e72ba288a2b0dee123b4841ac26cc (diff)
hafas: show lines at a glance; show messages (todo: verbosity setting)
Diffstat (limited to 'bin/hafas')
-rwxr-xr-xbin/hafas25
1 files changed, 23 insertions, 2 deletions
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 );