Debian Codegraph @

provides/zsh/completions/_efa

raw
1 #compdef efa
2
3 typeset -a arguments
4 typeset -A argument_pairs argument_postfix
5 typeset arg
6
7 argument_pairs=(
8 time t+
9 arrive a+
10 date d+
11 bike b
12 exclude e+
13 max-change m+
14 prefer P+
15 proximity p
16 include i+
17 walk-speed w+
18 ignore-info I+
19 version v
20 )
21
22 argument_postfix=(
23 time '[Journey start time]:timestamp'
24 arrive '[Journey end time]:timestamp'
25 date '[Journey date]:date'
26 bike '[Prefer connections where you can take a bike with you]'
27 exclude '[Exclude transport types]:transport type:_efa_transports'
28 max-change '[Maximum interchanges]:maximum interchange number'
29 prefer '[Prefer connections]:connection type:(speed nowait nowalk)'
30 proximity '[Take close stops into account]'
31 include '[Include extra connection types]:connection type:(local ic ice)'
32 walk-speed '[Walk speed]:walk speed:(normal fast slow)'
33 ignore-info '[Ignore additional information]:regex'
34 verison '[Print version information]'
35 )
36
37 arguments=(
38 '--'{from,to,via}':city: :stop: '
39 '--'{from,to,via}'-type:type:(stop address poi)'
40 '(--depart --arrive)--time:time'
41 '(--depart --time)--arrive:time'
42 '(--arrive --time)--depart:time'
43 '*--post:POST key=value'
44 )
45
46 for arg in ${(k)argument_pairs}; {
47 arguments+='(--'${arg}')-'${argument_pairs[$arg]}${argument_postfix[$arg]}
48 arguments+='(-'${${argument_pairs[$arg]}[1]}')--'${arg}${argument_postfix[$arg]}
49 }
50
51 function _efa_transports {
52 typeset -a keys used_prefixes
53 typeset prefix=''
54 keys=(zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus schnellbus seilbahn schiff ast sonstige)
55
56 if [[ -prefix *, ]] {
57 prefix=${words[$CURRENT]%,*},
58 used_prefixes=(${(s:,:)prefix})
59 }
60 _wanted expression expl 'sort expression' \
61 compadd -F used_prefixes -qS , -P "$prefix" $keys
62 }
63 _arguments -s $arguments