From 0f1d8e73698374561734a0c040ebcd44cb8bbd75 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 20 Jul 2015 20:44:26 +0200 Subject: efa: Improve ignore_info defaults based on accessibility and bike options --- bin/efa | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/efa b/bin/efa index 61e7106..7491c33 100755 --- a/bin/efa +++ b/bin/efa @@ -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 ], ) { -- cgit v1.2.3