summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog4
-rwxr-xr-xbin/efa-m29
2 files changed, 27 insertions, 6 deletions
diff --git a/Changelog b/Changelog
index 38a5279..e99a875 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+git HEAD
+
+ * Add -r, --relative option to use relative times
+
Travel::Status::DE::VRR 1.04 - Wed Oct 16 2013
* Add ->key accessor to Travel::Status::DE::VRR::Line
diff --git a/bin/efa-m b/bin/efa-m
index 6d542f8..525ea01 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -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>