diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/aseag-m | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/bin/aseag-m b/bin/aseag-m index 22303a6..7edb7d6 100755 --- a/bin/aseag-m +++ b/bin/aseag-m @@ -45,11 +45,12 @@ if ( @ARGV != 1 ) { for my $efield (@edata_pre) { given ($efield) { - when ('a') { $edata{route_after} = 1; $calculate_routes = 1 } - when ('b') { $edata{route_before} = 1; $calculate_routes = 1 } - when ('f') { $edata{route_full} = 1; $calculate_routes = 1 } - when ('T') { $edata{relative_times} = 1 } - default { $edata{$efield} = 1 } + when ('a') { $edata{route_after} = 1; $calculate_routes = 1 } + when ('b') { $edata{route_before} = 1; $calculate_routes = 1 } + when ('f') { $edata{route_full} = 1; $calculate_routes = 1 } + when ('r') { $edata{route_interesting} = 1; $calculate_routes = 1 } + when ('T') { $edata{relative_times} = 1 } + default { $edata{$efield} = 1 } } } @@ -76,7 +77,7 @@ sub show_version { sub display_result { my (@lines) = @_; - my @format = qw(%- %- %-); + my @format = qw(%- %- %- %-); if ( not @lines ) { die("Nothing to show\n"); @@ -86,17 +87,17 @@ sub display_result { $format[0] = q{%}; } - for my $i ( 0 .. 2 ) { + for my $i ( 0 .. 3 ) { $format[$i] .= max map { length( $_->[$i] ) } @lines; $format[$i] .= 's'; } for my $line (@lines) { - printf( join( q{ }, @format ) . "\n", @{$line}[ 0 .. 2 ] ); + printf( join( q{ }, @format ) . "\n", @{$line}[ 0 .. 3 ] ); - if ( @{ $line->[3] } ) { - for my $route ( @{ $line->[3] } ) { + if ( @{ $line->[4] } ) { + for my $route ( @{ $line->[4] } ) { printf( join( q{ }, @format ) . "\n", @{$route} ); } print "\n"; @@ -188,6 +189,7 @@ sub show_results { $d->datetime->subtract_datetime($dt_now) ), $d->line, + q{}, $d->destination, [ show_route( $dt_now, $dt_format, @route ) ], ); @@ -195,13 +197,17 @@ sub show_results { else { @line = ( $d->datetime->strftime($strftime_format), - $d->line, $d->destination, + $d->line, q{}, $d->destination, [ show_route( $dt_now, $dt_format, @route ) ], ); } if ( $edata{route_before} ) { - @{ $line[3] } = reverse @{ $line[3] }; + @{ $line[4] } = reverse @{ $line[4] }; + } + + if ( $edata{route_interesting} ) { + $line[2] = join( q{ }, $d->route_interesting ); } push( @output, \@line ); |