Skip to content
Snippets Groups Projects
Commit 8d1e7ef8 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

db-ris: Add --via (regex filter)

parent 86c3e352
No related branches found
No related tags found
No related merge requests found
......@@ -6,16 +6,19 @@ use 5.010;
our $VERSION = '0.0';
use Getopt::Long;
use List::Util qw(first);
use Travel::Status::DE::DeutscheBahn;
my ( $date, $time );
my $types = q{};
my %train_type;
my $filter_via;
binmode( STDOUT, ':encoding(utf-8)' );
GetOptions(
'd|date=s' => \$date,
'v|via=s' => \$filter_via,
'm|mot=s' => \$types,
't|time=s' => \$time,
);
......@@ -42,6 +45,10 @@ for my $d ( $status->departures() ) {
@via = $d->route;
if ( $filter_via and not( first { $_ =~ m{$filter_via}io } @via ) ) {
next;
}
for my $stop (@via) {
if ( $stop =~ m{ ?Hbf} ) {
push( @via_main, $stop );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment