summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-09-14 15:55:14 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-09-14 15:55:14 +0200
commit52b55d2a5c982c4a56db7dfde4326eb195798c63 (patch)
tree70f7c033a8a8aa1fb388bc9302aae42ebde32de5 /bin
parentaaa3810ffba6e7908b5a5480fc55887d1879fcf3 (diff)
HAFAS/hafas-m: Add StopFinder support
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hafas-m13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/hafas-m b/bin/hafas-m
index ffefecd..72c7560 100755
--- a/bin/hafas-m
+++ b/bin/hafas-m
@@ -103,6 +103,16 @@ sub parse_mot_options {
}
}
+sub show_similar_stops {
+ my @candidates = $status->similar_stops;
+ if (@candidates) {
+ say 'You might want to try one of the following stops:';
+ for my $c (@candidates) {
+ printf( "%s (%s)\n", $c->{name}, $c->{id} );
+ }
+ }
+}
+
sub display_result {
my (@lines) = @_;
@@ -141,6 +151,9 @@ sub display_result {
if ( my $err = $status->errstr ) {
say STDERR "Request error: ${err}";
+ if ( $status->errcode and $status->errcode eq 'H730' ) {
+ show_similar_stops();
+ }
exit 2;
}