Commit d621a8c7 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

efa: regroup some code pieces semantically

parent 79a9e0ee
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -283,6 +283,10 @@ else {
	$opt->{accessibility} = [];
}

if ( $opt->{exclude} ) {
	@{ $opt->{exclude} } = split( qr{,}, join( q{,}, @{ $opt->{exclude} } ) );
}

for my $field ( @{ $opt->{accessibility} } ) {
	given ($field) {
		when ( [qw[s no-stairs]] )       { $opt->{without_solid_stairs} = 1 }
@@ -309,18 +313,6 @@ if ( $opt->{arrive} and $opt->{depart} ) {
	delete $opt->{arrive};
}

if ( not( @from and @to ) ) {
	if ( @ARGV == 4 ) {
		( @from[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV;
	}
	elsif ( @ARGV == 6 ) {
		( @from[ 0, 1 ], @via[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV;
	}
	else {
		show_help(1);
	}
}

if ( not defined $ignore_info ) {
	$ignore_info = join(
		q{|},
@@ -333,6 +325,21 @@ if ( not defined $ignore_info ) {
		)
	);
}
elsif ( defined $ignore_info and length($ignore_info) == 0 ) {
	$ignore_info = undef;
}

if ( not( @from and @to ) ) {
	if ( @ARGV == 4 ) {
		( @from[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV;
	}
	elsif ( @ARGV == 6 ) {
		( @from[ 0, 1 ], @via[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV;
	}
	else {
		show_help(1);
	}
}

for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ],
	[ \@to, \$to_type ], )
@@ -352,14 +359,6 @@ for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ],
	}
}

if ( defined $opt->{'ignore-info'} and length( $opt->{'ignore-info'} ) == 0 ) {
	$opt->{'ignore-info'} = undef;
}

if ( $opt->{exclude} ) {
	$opt->{exclude} = [ split( qr{,}, join( q{,}, @{ $opt->{exclude} } ) ) ];
}

if ( $opt->{service} ) {
	my $service = first { lc( $_->{shortname} ) eq lc( $opt->{service} ) }
	Travel::Routing::DE::EFA::get_efa_urls();