From b5d492e649d266ae78ceb1bd7d04d22fc79a9ef9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 11 Dec 2013 01:15:11 +0100 Subject: -f (--full-route) support --- bin/aseag-m | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/aseag-m b/bin/aseag-m index c25c438..1fb593f 100755 --- a/bin/aseag-m +++ b/bin/aseag-m @@ -14,11 +14,13 @@ use List::Util qw(max); use Travel::Status::DE::ASEAG; my (@grep_lines); +my $show_full_route = 0; GetOptions( - 'h|help' => sub { show_help(0) }, - 'l|line=s@' => \@grep_lines, - 'V|version' => \&show_version, + 'h|help' => sub { show_help(0) }, + 'f|full-route' => \$show_full_route, + 'l|line=s@' => \@grep_lines, + 'V|version' => \&show_version, ) or show_help(1); @@ -31,7 +33,10 @@ if ( @ARGV != 1 ) { my ($stop_name) = @ARGV; -my $status = Travel::Status::DE::ASEAG->new( name => $stop_name, ); +my $status = Travel::Status::DE::ASEAG->new( + name => $stop_name, + full_routes => $show_full_route +); sub show_help { my ($code) = @_; @@ -66,6 +71,10 @@ sub display_result { join( q{ }, ( map { "%-${_}s" } @line_length ) ) . "\n", @{$line}[ 0 .. 2 ] ); + + if ($show_full_route) { + print "\n" . $line->[3] . "\n\n\n"; + } } return; @@ -82,7 +91,17 @@ sub show_results { next; } - push( @output, [ $dtime, $d->line, $d->destination ] ); + push( + @output, + [ + $dtime, + $d->line, + $d->destination, + join( "\n", + map { sprintf( '%-8s %s', @{$_} ) } + @{ $d->route_timetable } ) + ] + ); } display_result(@output); @@ -119,6 +138,10 @@ B lists upcoming bus departures at the ASEAG stop I. =over +=item B<-f>, B<--full-route> + +Display complete routes (including arrival times) of all buses. + =item B<-l>, B<--line> I Only show departures of I (comma-separatad list, option may be -- cgit v1.2.3