From 43a52169cfec80d171a810796c4eef0bd48cf6d0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 26 Jun 2015 15:51:20 +0200 Subject: add proper -Of / -Oa / -Ob support --- bin/efa-m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/efa-m b/bin/efa-m index 54045b6..5493b85 100755 --- a/bin/efa-m +++ b/bin/efa-m @@ -11,7 +11,7 @@ our $VERSION = '1.10'; binmode( STDOUT, ':encoding(utf-8)' ); use Encode qw(decode); -use Getopt::Long qw(:config no_ignore_case); +use Getopt::Long qw(:config no_ignore_case bundling); use List::Util qw(first max); use Travel::Status::DE::EFA; @@ -61,9 +61,11 @@ if ( $input =~ s{ ^ (? address|poi|stop) : }{}x ) { for my $efield (@edata_pre) { given ($efield) { - when ('f') { $edata{fullroute} = 1; $full_routes = 1 } - when ('r') { $edata{route} = 1; $full_routes = 1 } - default { $edata{$efield} = 1 } + when ('a') { $edata{route_after} = 1; $full_routes = 1 } + when ('b') { $edata{route_before} = 1; $full_routes = 1 } + when ('f') { $edata{fullroute} = 1; $full_routes = 1 } + when ('r') { $edata{route} = 1; $full_routes = 1 } + default { $edata{$efield} = 1 } } } if ($filter_via) { @@ -159,7 +161,7 @@ sub display_result { @{$line}[ 0 .. 4 ] ); - if ( $line->[6] and $edata{fullroute} ) { + if ( $line->[6] ) { say $line->[6]; } } @@ -237,8 +239,17 @@ sub show_results { } if ( $edata{fullroute} ) { + $output_line[6] + = format_route( $d->route_pre ) + . ' -' x 30 . "\n" + . format_route( $d->route_post ); + } + elsif ( $edata{route_after} ) { $output_line[6] = format_route( $d->route_post ); } + elsif ( $edata{route_before} ) { + $output_line[6] = format_route( reverse $d->route_pre ); + } push( @output, \@output_line ); } -- cgit v1.2.3