From 2542ed41c818ba1cd1e000bc4b5c133972507aea Mon Sep 17 00:00:00 2001 From: Derf Null Date: Mon, 10 Apr 2023 21:42:06 +0200 Subject: add locationSearch support --- bin/hafas-m | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bin/hafas-m') diff --git a/bin/hafas-m b/bin/hafas-m index 2e48a90..e53a910 100755 --- a/bin/hafas-m +++ b/bin/hafas-m @@ -66,6 +66,10 @@ if ( $opt{station} =~ m{ ^ (? [0-9.]+ ) : (? [0-9].+ ) $ }x ) { }; delete $opt{station}; } +elsif ( $opt{station} =~ m{ ^ [?] (? .*) $ }x ) { + $opt{locationSearch} = $+{query}; + delete $opt{station}; +} elsif ( $opt{station} =~ m{[|]} ) { $opt{journey} = { id => $opt{station} }; delete $opt{station}; @@ -251,6 +255,12 @@ if ( $opt{geoSearch} ) { } exit 0; } +elsif ( $opt{locationSearch} ) { + for my $result ( $status->results ) { + printf( "%8d %s\n", $result->eva, $result->name ); + } + exit 0; +} elsif ( $opt{journey} ) { my $result = $status->result; -- cgit v1.2.3