blob: 84d805ce4dcff7751da5e4af81587af26836f6ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#compdef efa
typeset -a arguments
arguments=(
'--from:city: :stop: '
'--to:city: :stop: '
'--via:city: :stop: '
'--bike'
'--debug'
'(--depart --arrive)--time:time'
'(--depart --time)--arrive:time'
'(--arrive --time)--depart:time'
'--date:date'
'*--exclude:transports:_efa_transports'
'--max-change:number'
'--prefer:type:(speed nowait nowalk)'
'--proximity'
'--restrict:type:(local ic ice)'
'--walk-speed:speed:(normal fast slow)'
'--ignore-info:regex'
'*--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
|