From 9c9c9cb99c0128798e68c9beeb203fd092444c3d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 19 May 2009 21:01:22 +0200 Subject: efa: Added --prefer option (choose connection based on speed/interchanges/walking) --- bin/efa | 35 ++++++++++++++++++++++++++++++++++- provides/zsh/completions/_efa | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) 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 + +Prefer connections of I: + +=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 Only accept connections using trains of type I, where I 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' -- cgit v1.2.3