diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-12-13 10:18:20 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-12-13 10:18:20 +0100 |
commit | 6467b8b5e149cce9dff5ee9c221f31af79768677 (patch) | |
tree | 71091a776ecfd0fbc16d0a7e32e4a98fbe175256 /bin | |
parent | d54ae7d775ee90863a03d047bcc193cbd15e1336 (diff) |
add -r / --relative option
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/efa-m | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -13,7 +13,7 @@ use Getopt::Long qw(:config no_ignore_case); use List::Util qw(max); use Travel::Status::DE::VRR; -my ( $date, $time, $input_type, $list_lines ); +my ( $date, $time, $input_type, $list_lines, $relative_times ); my ( @grep_lines, @grep_platforms ); GetOptions( @@ -22,6 +22,7 @@ GetOptions( 'l|line=s@' => \@grep_lines, 'L|linelist' => \$list_lines, 'p|platform=s@' => \@grep_platforms, + 'r|relative' => \$relative_times, 't|time=s' => \$time, 'V|version' => \&show_version, @@ -121,7 +122,8 @@ sub show_results { for my $d ( $status->results ) { my $platform = $d->platform; - my $dtime = $d->time; + my $dtime = ( + $relative_times ? sprintf( '%2d min', $d->countdown ) : $d->time ); if ( $d->platform_db ) { $platform .= ' (DB)'; @@ -137,14 +139,25 @@ sub show_results { } if ( $d->is_cancelled ) { - $dtime .= ' CANCELED'; + if ($relative_times) { + next; + } + else { + $dtime .= ' CANCELED'; + } } if ( $d->delay ) { $dtime .= ' (+' . $d->delay . ')'; } - push( @output, - [ $dtime, $platform, $d->line, $d->destination, $d->info ] ); + if ($relative_times) { + push( @output, + [ $platform, $d->line, $d->destination, $dtime, $d->info ] ); + } + else { + push( @output, + [ $dtime, $platform, $d->line, $d->destination, $d->info ] ); + } } display_result(@output); @@ -204,9 +217,13 @@ repeated) Only show departures at I<platforms> (comma-separated list, option may be repeated). Note that the C<< Bstg. >> / C<< Gleis >> prefix must be omitted. +=item B<-r>, B<--relative> + +Use relative departure times. + =item B<-t>, B<--time> I<hh:mm> -Show departures starting at I<time> instead of now +Show departures starting at I<time> instead of now. =item B<-V>, B<--version> |