File: zun.zsh_completion

package info (click to toggle)
python-zunclient 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,052 kB
  • sloc: python: 10,127; sh: 110; makefile: 25
file content (29 lines) | stat: -rw-r--r-- 715 bytes parent folder | download | duplicates (5)
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
#compdef zun

local -a nbc _zun_opts _zun_flags _zun_opts_exp cur prev

nbc=(${(ps: :)$(_call_program options "$service bash-completion" 2>/dev/null)})
_zun_opts=(${nbc:#-*})
_zun_flags=(${(M)nbc:#-*})
_zun_opt_exp=${${nbc:#-*}// /|}
cur=$words[CURRENT]
prev=$words[(( CURRENT - 1 ))]

_checkcomp(){
    for word in $words[@]; do
        if [[ -n ${_zun_opts[(r)$word]} ]]; then
            return 0
        fi
    done
    return 1
}

echo $_zun_opts[@] |grep --color zun
if [[ "$prev" != "help" ]] && _checkcomp; then
    COMPLETION_CACHE=(~/.zunclient/*/*-cache)
    cflags=($_zun_flags[@] ${(ps: :)$(cat $COMPLETION_CACHE 2>/dev/null)})
    compadd "$@" -d $cflags[@]
else
    compadd "$@" -d $_zun_opts[@]
fi