summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-05-19 21:01:22 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-05-19 21:01:22 +0200
commit9c9c9cb99c0128798e68c9beeb203fd092444c3d (patch)
tree237601d6f61bb0a6d7ba53caac2419497cba995f
parent713f157b4858d14ea373bbec2c5e11ba4cae7492 (diff)
efa: Added --prefer option (choose connection based on speed/interchanges/walking)
-rwxr-xr-xbin/efa35
-rw-r--r--provides/zsh/completions/_efa1
2 files changed, 35 insertions, 1 deletions
diff --git a/bin/efa b/bin/efa
index 6916644..ed902df 100755
--- a/bin/efa
+++ b/bin/efa
@@ -22,6 +22,7 @@ my (@from, @to, @via);
my ($time, $time_depart, $time_arrive);
my $date;
my $restrict;
+my $prefer;
my $debug = 0;
my $ignore_info = 'Fahrradmitnahme';
my ($i, $j, $con, $part);
@@ -119,6 +120,7 @@ GetOptions(
'help' => sub {exec('perldoc', $0)},
'ignore-info=s' => \$ignore_info,
'post=s' => \%post,
+ 'prefer=s' => \$prefer,
'restrict=s' => \$restrict,
'time=s' => \$time,
'to=s{2}' => \@to,
@@ -159,6 +161,17 @@ if ($date) {
@post{'itdDateDay','itdDateMonth','itdDateYear'} = split(/\./, $date);
}
+if ($prefer) {
+ given($prefer) {
+ when('speed') { $post{routeType} = 'LEASTTIME' }
+ when('nowait') { $post{routeType} = 'LEASTINTERCHANGE' }
+ when('nowalk') { $post{routeType} = 'LEASTWALKING' }
+ default {
+ print STDERR "--prefer usage: speed / nowait / nowalk\n";
+ }
+ }
+}
+
if ($restrict) {
given ($restrict) {
when('local') { $post{lineRestriction} = 403 }
@@ -267,13 +280,33 @@ Journey end time (overrides --time/--depart)
Journey date
+=item B<--prefer> I<type>
+
+Prefer connections of I<type>:
+
+=over
+
+=item * speed (default)
+
+The faster, the better
+
+=item * nowait
+
+Prefer connections with less interchanges
+
+=item * nowalk
+
+Prefer connections with less walking (at interchanges)
+
+=back
+
=item B<--restrict> I<type>
Only accept connections using trains of type I<type>, where I<type> may be:
=over
-=item * local
+=item * local (default)
only take local trains ("Verbund-/Nahverkehrslinien"). Slow, but the cheapest
method if you're not travelling long distance
diff --git a/provides/zsh/completions/_efa b/provides/zsh/completions/_efa
index 96fc737..b169ace 100644
--- a/provides/zsh/completions/_efa
+++ b/provides/zsh/completions/_efa
@@ -10,6 +10,7 @@ arguments=(
'(--depart --time)--arrive:time'
'(--arrive --time)--depart:time'
'--date:date'
+ '--prefer:type:(speed nowait nowalk)'
'--restrict:type:(local ic ice)'
'--ignore-info:regex'
'*--post:POST key=value'