summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-09-04 13:27:01 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-09-04 13:27:01 +0200
commit8f6e84a46ebcbec90630bdaf39b935f71114c80d (patch)
tree2f279c077c2928e9577c69bcc45475e743666022
parentca37cdd0009298b677ffbc356741098d609c474d (diff)
db-ris: Add -f/--full-route option
-rw-r--r--Changelog8
-rwxr-xr-xbin/db-ris31
2 files changed, 31 insertions, 8 deletions
diff --git a/Changelog b/Changelog
index b794ad1..9eaf1d0 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,13 @@
git HEAD
+ [db-ris]
+ * Add --full-route option
+
+ [Travel::Status::DE::DeutscheBahn]
* Fix bug when receiving no platform numbers from the DB RIS
- * Result: Add route_timetable accessor containing station names and
+
+ [Travel::Status::DE::DeutscheBahn::Result]
+ * Add route_timetable accessor containing station names and
their corresponding arrival times
Travel::Status::DE::DeutscheBahn 0.05 - Tue Aug 09 2011
diff --git a/bin/db-ris b/bin/db-ris
index 3dea411..d9ad07b 100755
--- a/bin/db-ris
+++ b/bin/db-ris
@@ -13,8 +13,9 @@ my %train_type;
my ( $date, $time );
my $filter_via;
-my $ignore_late = 0;
-my $types = q{};
+my $ignore_late = 0;
+my $show_full_route = 0;
+my $types = q{};
my @output;
@@ -22,6 +23,7 @@ binmode( STDOUT, ':encoding(utf-8)' );
GetOptions(
'd|date=s' => \$date,
+ 'f|full-route' => \$show_full_route,
'h|help' => sub { show_help(0) },
'L|ignore-late' => \$ignore_late,
'm|mot=s' => \$types,
@@ -77,8 +79,14 @@ sub display_result {
}
for my $line (@lines) {
- printf( join( q{ }, ( map { "%-${_}s" } @line_length ) ) . "\n",
- @{$line}, );
+ printf(
+ join( q{ }, ( map { "%-${_}s" } @line_length ) ) . "\n",
+ @{$line}[ 0 .. 5 ]
+ );
+
+ if ($show_full_route) {
+ print "\n" . $line->[6] . "\n\n\n";
+ }
}
return;
@@ -106,9 +114,14 @@ for my $d ( $status->results() ) {
push(
@output,
[
- $d->time, $d->train,
- join( q{ }, $d->route_interesting ), $d->destination,
- $d->platform, $d->info,
+ $d->time,
+ $d->train,
+ join( q{ }, $d->route_interesting ),
+ $d->destination,
+ $d->platform,
+ $d->info,
+ join( "\n",
+ map { sprintf( '%-5s %s', @{$_} ) } $d->route_timetable ),
]
);
}
@@ -147,6 +160,10 @@ departure screens installed at most main stations.
Date to list departures for. Default: today.
+=item B<-f>, B<--full-route>
+
+Display complete routes (including arrival times) of all trains.
+
=item B<-L>, B<--ignore-late>
Do not display delayed trains.