diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-09-14 15:55:14 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-09-14 15:55:14 +0200 |
commit | 52b55d2a5c982c4a56db7dfde4326eb195798c63 (patch) | |
tree | 70f7c033a8a8aa1fb388bc9302aae42ebde32de5 /bin | |
parent | aaa3810ffba6e7908b5a5480fc55887d1879fcf3 (diff) |
HAFAS/hafas-m: Add StopFinder support
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hafas-m | 13 |
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; } |