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

typeset -a arguments
arguments=(
	'--from:city: :stop: '
	'--to:city: :stop: '
	'--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'
	'--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