#compdef efa ## completion for efa 1.0.5, based on efa(1) function _efa_include { typeset -a types types=( 'local:only take local trains (default)' 'ic:local trains + IC' 'ice:All kind of trains' ) _describe 'train type' types } function _efa_prefer { typeset -a preferences preferences=( 'speed:prefer fast connections' 'nowait:prefer connections with little interchanges' 'nowalk:prefer connections with little walking at interchanges' ) _describe 'connection preference' preferences } 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 'mode of transportation' \ compadd -F used_prefixes -qS , -P "$prefix" $keys } function _efa { _arguments -s \ {--from,--to,--via}':city: :stop: ' \ '(-t --time --depart)'{-t,--time,--depart}'[departure time]:HH\:MM' \ '(-a --arrive)'{-a,--arrive}'[arrival time]:HH\:MM' \ '(-d --date)'{-d,--date}'[journey date]:DD.MM.[YYYY]' \ '(-b --bike)'{-b,--bike}'[prefer connections allowing bike take-along]' \ '(-e --exclude)'{-e,--exclude}'[exclude transport types]: :_efa_transports' \ '(-m --max-change)'{-m,--max-change}'[maximum number of interchanges]:number' \ '(-P --prefer)'{-P,--prefer}'[set connection preference]:preference:_efa_prefer' \ '(-p --proximity)'{-p,--proximity}'[take close stops into account]' \ '(-i --include)'{-i,--include}'[use extra connection types]:type:_efa_include' \ '(-w --walk-speed)'{-w,--walk-speed}'[set walking speed]:speed:(normal fast slow)' \ '(-I --ignore-info)'{-I,--ignore-info}'[ignore information]:regular expression' \ '--timeout[set request timeout]:seconds' \ '--post[set custom POST key]:key=value' \ '(-v --version)'{-v,--version}'[show version information]' } _efa "$@"