summaryrefslogtreecommitdiff
path: root/bin/efa-m
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-09-25 21:29:00 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-09-25 21:29:00 +0200
commit385b25b93a3f10a4044df9fc73027b8ae70dbc8a (patch)
tree60f95792aefe21c97766dfc0fafd0f7715fc2078 /bin/efa-m
parent28ba9a1b23beb2121ff1b57d6139be70a3d808b4 (diff)
add primitive stopseq output
TODO: Proper classes, locality/parent handling, et cetera
Diffstat (limited to 'bin/efa-m')
-rwxr-xr-xbin/efa-m25
1 files changed, 24 insertions, 1 deletions
diff --git a/bin/efa-m b/bin/efa-m
index 9df1e37..9ddb70b 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -258,6 +258,26 @@ sub display_result {
return;
}
+sub show_stopseq {
+ my $trip = $efa->result;
+
+ printf( "%s %s → %s\n",
+ $trip->line, $trip->number // q{},
+ $trip->dest_name );
+
+ for my $stop ( $trip->route ) {
+ printf( "%s → %s %s\n",
+ $stop->{sched_arr}
+ ? ( $stop->{rt_arr} // $stop->{sched_arr} )->strftime('%H:%M')
+ : q{ },
+ $stop->{sched_dep}
+ ? ( $stop->{rt_dep} // $stop->{sched_dep} )->strftime('%H:%M')
+ : q{ },
+ $stop->{name_full},
+ );
+ }
+}
+
sub show_lines {
my @output;
@@ -449,7 +469,10 @@ if ( my $err = $efa->errstr ) {
exit 2;
}
-if ($list_lines) {
+if ($stopseq) {
+ show_stopseq();
+}
+elsif ($list_lines) {
show_lines();
}
else {