summaryrefslogtreecommitdiff
path: root/bin/hafas-m
diff options
context:
space:
mode:
authorDerf Null <derf@finalrewind.org>2023-04-10 21:42:06 +0200
committerDerf Null <derf@finalrewind.org>2023-04-10 21:42:06 +0200
commit2542ed41c818ba1cd1e000bc4b5c133972507aea (patch)
tree98132d2b257b076b7b9e83147c5da17fb41d178b /bin/hafas-m
parenta789b0e271dc66498896176d02afd18c13744fc1 (diff)
add locationSearch support
Diffstat (limited to 'bin/hafas-m')
-rwxr-xr-xbin/hafas-m10
1 files changed, 10 insertions, 0 deletions
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{ ^ (?<lat> [0-9.]+ ) : (?<lon> [0-9].+ ) $ }x ) {
};
delete $opt{station};
}
+elsif ( $opt{station} =~ m{ ^ [?] (?<query> .*) $ }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;