summaryrefslogtreecommitdiff
path: root/provides/zsh/completions/_efa
blob: 97955c3afb805355ce6fab5eb038b5dfe7769e95 (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
#compdef efa

typeset -a arguments
arguments=(
	'--'{from,to,via}':city: :stop: '
	'--'{from,to,via}'-type:type:(stop address poi)'
	'--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'
	'--include: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