diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-07-20 20:44:26 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-07-20 20:44:26 +0200 |
commit | 0f1d8e73698374561734a0c040ebcd44cb8bbd75 (patch) | |
tree | 46881b830abea15b917294b72d591a1d05512b0b /bin | |
parent | 9361286ff8eed87a79a19648bb86b5cd8fdf98f5 (diff) |
efa: Improve ignore_info defaults based on accessibility and bike options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/efa | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -17,7 +17,7 @@ use Getopt::Long qw/:config no_ignore_case/; use List::Util qw(first); our $VERSION = '2.12'; -my $ignore_info = 'Fahrradmitnahme|Einstiegshilfe'; +my $ignore_info; my $efa; my $efa_url = 'http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2'; my %accessibility; @@ -237,7 +237,7 @@ GetOptions( if ( $opt->{accessibility} ) { @{ $opt->{accessibility} } - = split( qr{,}, join( q{,}, @{ $opt->{accessibility} } ) ); + = split( qr{,}, join( q{,}, @{ $opt->{accessibility} } ) ); } for my $field ( @{ $opt->{accessibility} } ) { @@ -247,6 +247,7 @@ for my $field ( @{ $opt->{accessibility} } ) { when ( [qw[E no-elevators]] ) { $opt->{without_elevators} = 1 } when ( [qw[l nf low-platform]] ) { $opt->{with_low_platform} = 1 } when ( [qw[w wheelchair]] ) { $opt->{with_wheelchair} = 1 } + when ( [qw[i info]] ) { } # used for ignore_info default } } @@ -277,6 +278,16 @@ if ( not( @from and @to ) ) { } } +if ( not defined $ignore_info ) { + $ignore_info = join( + q{|}, + grep { defined } ( + @{$opt->{accessibility}} ? undef : 'Einstiegshilfe', + $opt->{bike} ? undef : 'Fahrradmitnahme', + ) + ); +} + for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ], [ \@to, \$to_type ], ) { |