From 40e6e7e5cc4dbc8d23389a86fdd042ac9230060b Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 22 Nov 2023 21:38:07 +0100 Subject: hafas: add -f/--full-route option (Section: pass date to Journey for ->route) --- bin/hafas | 18 ++++++++++++++++++ lib/Travel/Routing/DE/HAFAS/Connection/Section.pm | 1 + 2 files changed, 19 insertions(+) diff --git a/bin/hafas b/bin/hafas index 5bb3634..3434aa7 100755 --- a/bin/hafas +++ b/bin/hafas @@ -19,6 +19,7 @@ my ( $date, $time, $language ); my $types = q{}; my $developer_mode; my $json_output; +my $show_full_route; my ( $list_services, $service ); my ( @excluded_mots, @exclusive_mots ); my $verbosity = 0; @@ -45,6 +46,7 @@ my $output_reset = -t STDOUT ? "\033[0m" : q{}; GetOptions( 'd|date=s' => \$date, 'h|help' => sub { show_help(0) }, + 'f|full-route' => \$show_full_route, 'l|language=s' => \$language, 'm|mot=s' => \$types, 's|service=s' => \$service, @@ -364,6 +366,22 @@ for my $res ( $hafas->connections ) { $sec->dep_platform ? q{: } : q{}, $sec->dep_platform // q{}, ); + if ($show_full_route) { + for my $stop ( $sec->journey->route ) { + if ( $stop->loc != $sec->dep_loc + and $stop->loc != $sec->arr_loc ) + { + printf( + "%-5s %-${delay_fmt}s %s%s%s\n", + $stop->arr ? $stop->arr->strftime('%H:%M') : q{}, + format_delay( $stop->arr_delay, $delay_len ), + $stop->loc->name, + $stop->platform ? q{: } : q{}, + $stop->platform // q{}, + ); + } + } + } printf( "%-5s %-${delay_fmt}s an %s%s%s\n", $sec->arr_cancelled diff --git a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm index ba1347a..220b392 100644 --- a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm +++ b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm @@ -108,6 +108,7 @@ sub new { $ref->{journey} = Travel::Status::DE::HAFAS::Journey->new( common => $opt{common}, + date => $date, locL => $locs, journey => $sec->{jny}, hafas => $hafas, -- cgit v1.2.3