diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-11-28 21:14:04 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-11-28 21:14:04 +0100 |
commit | 107ca44298c6f65ebfc269646e2184d2adba7810 (patch) | |
tree | 0d3bf66981384ee0158da2bc8a87d3551eef9b42 /bin | |
parent | 24a55903ddceb8107c527d637f57f7c1d135ef8e (diff) |
efa: Add -E option to display total route time and ticket class/price
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/efa | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -6,6 +6,8 @@ use strict; use warnings; use 5.010; +use utf8; + use Travel::Routing::DE::VRR; use Exception::Class; use Getopt::Long qw/:config no_ignore_case/; @@ -112,6 +114,7 @@ GetOptions( date|d=s depart=s exclude|e=s@ + extended-info|E from=s@{2} help|h ignore-info|I:s @@ -188,7 +191,23 @@ check_for_error($@); my @routes = $efa->routes; for my $i ( 0 .. $#routes ) { - for my $c ( $routes[$i]->parts ) { + + my $route = $routes[$i]; + + if ($opt->{'extended-info'}) { + print '# ' . $route->duration; + if ($route->ticket_type) { + printf(", class %s (%s€ / %s€)\n\n", + $route->ticket_type, + $route->fare_adult, $route->fare_child, + ); + } + else { + print "\n\n"; + } + } + + for my $c ( $route->parts ) { for my $extra ( $c->extra ) { |