diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-10-07 18:29:12 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-10-07 18:29:12 +0200 |
commit | e0845072109fce647b5b61076f8bba978d3adf65 (patch) | |
tree | 98b308ac86184f774c32bca0c885c2ae3e2b0197 /bin | |
parent | d35b36d0b81c12fbb828a59f2305e491306b9840 (diff) |
route_interesting support in aseag-m
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 ); |