From 1157ac67b6ba95c0b6d7b90f135e7c0abb1001f6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 13 Dec 2013 08:28:09 +0100 Subject: add -r / --relative option --- bin/aseag-m | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'bin/aseag-m') diff --git a/bin/aseag-m b/bin/aseag-m index 2c4e655..73b5236 100755 --- a/bin/aseag-m +++ b/bin/aseag-m @@ -14,8 +14,9 @@ use List::Util qw(max); use Travel::Status::DE::ASEAG; my (@grep_lines); -my $full_route = 0; -my $hide_past = 1; +my $full_route = 0; +my $hide_past = 1; +my $relative_times = 0; my $via; GetOptions( @@ -25,6 +26,7 @@ GetOptions( 'f|full-route' => \$full_route, 'l|line=s@' => \@grep_lines, 'p|with-past' => sub { $hide_past = 0 }, + 'r|relative' => \$relative_times, 'v|via=s' => \$via, 'V|version' => \&show_version, @@ -103,17 +105,32 @@ sub show_results { next; } - push( - @output, - [ - $dtime, - $d->line, - $d->destination, - join( "\n", - map { sprintf( '%-8s %s', @{$_} ) } - @{ $d->route_timetable } ) - ] - ); + if ($relative_times) { + push( + @output, + [ + $d->line, + $d->destination, + sprintf( '%3d min', $d->countdown ), + join( "\n", + map { sprintf( '%-8s %s', @{$_} ) } + @{ $d->route_timetable } ) + ] + ); + } + else { + push( + @output, + [ + $dtime, + $d->line, + $d->destination, + join( "\n", + map { sprintf( '%-8s %s', @{$_} ) } + @{ $d->route_timetable } ) + ] + ); + } } display_result(@output); @@ -172,6 +189,10 @@ repeated) Also show departures in the past. Also appleas to the route information of B<-a> / B<-b> / B<-f>. +=item B<-r>, B<--relative> + +Use relative departure and route times. + =item B<-v>, B<--via> I Only show lines which will also service I. With B<-b>, I must be -- cgit v1.2.3