summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-12-11 01:15:11 +0100
committerDaniel Friesel <derf@finalrewind.org>2013-12-11 01:15:11 +0100
commitb5d492e649d266ae78ceb1bd7d04d22fc79a9ef9 (patch)
treeaada3a158260eef91bcff06b0826aa746ee37bce /bin
parentad4b1b28b4f35a4fa72453994a150f11cad03182 (diff)
-f (--full-route) support
Diffstat (limited to 'bin')
-rwxr-xr-xbin/aseag-m33
1 files changed, 28 insertions, 5 deletions
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<aseag-m> lists upcoming bus departures at the ASEAG stop I<name>.
=over
+=item B<-f>, B<--full-route>
+
+Display complete routes (including arrival times) of all buses.
+
=item B<-l>, B<--line> I<lines>
Only show departures of I<lines> (comma-separatad list, option may be