From 52b55d2a5c982c4a56db7dfde4326eb195798c63 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 14 Sep 2015 15:55:14 +0200 Subject: HAFAS/hafas-m: Add StopFinder support --- bin/hafas-m | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bin') 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; } -- cgit v1.2.3