summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/efa34
-rw-r--r--provides/zsh/completions/_efa13
2 files changed, 47 insertions, 0 deletions
diff --git a/bin/efa b/bin/efa
index db89e54..9d8f1e5 100755
--- a/bin/efa
+++ b/bin/efa
@@ -21,6 +21,7 @@ my $cons;
my (@from, @to, @via);
my ($time, $time_depart, $time_arrive);
my $date;
+my @exclude;
my $maxinter;
my $restrict;
my $prefer;
@@ -118,6 +119,7 @@ GetOptions(
'date=s' => \$date,
'debug' => \$debug,
'depart=s' => \$time_depart,
+ 'exclude=s' => \@exclude,
'from=s{2}' => \@from,
'help' => sub {exec('perldoc', $0)},
'ignore-info=s' => \$ignore_info,
@@ -131,6 +133,8 @@ GetOptions(
'via=s{2}' => \@via,
);
+@exclude = split(/,/, join(',', @exclude));
+
unless (@from and @to) {
if (@ARGV == 4) {
(@from[0,1], @to[0,1]) = @ARGV;
@@ -165,6 +169,28 @@ if ($date) {
@post{'itdDateDay','itdDateMonth','itdDateYear'} = split(/\./, $date);
}
+if (@exclude) {
+ foreach(@exclude) {
+ given($_) {
+ when('zug') { $post{inclMOT_0} = undef }
+ when('s-bahn') { $post{inclMOT_1} = undef }
+ when('u-bahn') { $post{inclMOT_2} = undef }
+ when('stadtbahn') { $post{inclMOT_3} = undef }
+ when('tram') { $post{inclMOT_4} = undef }
+ when('stadtbus') { $post{inclMOT_5} = undef }
+ when('regionalbus') { $post{inclMOT_6} = undef }
+ when('schnellbus') { $post{inclMOT_7} = undef }
+ when('seilbahn') { $post{inclMOT_8} = undef }
+ when('schiff') { $post{inclMOT_9} = undef }
+ when('ast') { $post{inclMOT_10} = undef }
+ when('sonstige') {$post{inclMOT_11} = undef }
+ default {
+ print STDERR "--exclude: invaled argument\n";
+ }
+ }
+ }
+}
+
if (defined($maxinter)) {
$post{maxChanges} = $maxinter;
}
@@ -203,6 +229,7 @@ $www->submit_form(
);
$content = $www->content;
+
if (check_ambiguous($content)) {
exit(1);
}
@@ -292,6 +319,13 @@ Journey end time (overrides --time/--depart)
Journey date
+=item B<--exclude> I<transports>
+
+Exclude I<transports> (comma separated list).
+
+Possible transports: zug, s-bahn, u-bahn, stadtbahn, tram, stadtbus, regionalbus,
+schnellbus, seilbahn, schiff, ast, sonstige
+
=item B<--max-change> I<number>
Print connections with at most I<number> interchanges
diff --git a/provides/zsh/completions/_efa b/provides/zsh/completions/_efa
index 92f3bad..568e572 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'
+ '*--exclude:transports:_efa_transports'
'--max-change:number'
'--prefer:type:(speed nowait nowalk)'
'--proximity'
@@ -18,4 +19,16 @@ arguments=(
'*--post:POST key=value'
)
+function _efa_transports {
+ typeset -a keys used_prefixes
+ typeset prefix=''
+ keys=(zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus schnellbus seilbahn schiff ast sonstige)
+
+ if [[ -prefix *, ]] {
+ prefix=${words[$CURRENT]%,*},
+ used_prefixes=(${(s:,:)prefix})
+ }
+ _wanted expression expl 'sort expression' \
+ compadd -F used_prefixes -qS , -P "$prefix" $keys
+}
_arguments -s $arguments