Merge pull request #964 from AladW/examples-overhaul
[aurutils.git] / completions / zsh / aurutils.in
blob55c2ddb5a49bdcefed5ff132e368f6c99e3a0a0f
1 #!/bin/bash
2 cat <<'EOF'
3 #compdef aur
5 zstyle ':completion::complete:aur:argument-rest:' sort false
7 _aur() {
8 local context state state_descr line
9 typeset -A opt_args
11 typeset -A default_cmds
13 EOF
14 source ./command_opts.sh
15 default_opts
16 cat <<'EOF'
18 _arguments -C \
19 '1: :(${(k)default_cmds})' \
20 '2: :(${(@s/ /)default_cmds[${words[2]}]})' \
21 '*: :->options'
23 case $state in
24 options)
25 if [[ ${default_cmds[${words[2]}]} != *${words[-2]}:* ]]; then
26 _arguments '*: :(${=default_cmds[${words[2]}]//:/})'
27 else
28 _files
29 fi ;;
30 esac
32 EOF