]>
Commit | Line | Data |
---|---|---|
1 | have poldek && { | |
2 | ||
3 | # poldek(1) completion | |
4 | # | |
5 | _poldek() | |
6 | { | |
7 | local cur prev | |
8 | cur=${COMP_WORDS[COMP_CWORD]} | |
9 | ||
10 | COMPREPLY=() | |
11 | ||
12 | case "${COMP_WORDS[1]}" in | |
13 | -@(e|-erase)) | |
14 | if [[ "$cur" == -* ]]; then | |
15 | COMPREPLY=( $( compgen -W '--nodeps --nofollow --test' -- $cur ) ) | |
16 | else | |
17 | _rpm_installed_packages | |
18 | fi | |
19 | return 0 | |
20 | ;; | |
21 | esac | |
22 | ||
23 | prev=${COMP_WORDS[COMP_CWORD-1]} | |
24 | ||
25 | case "$prev" in | |
26 | -@(n|-sn)) | |
27 | COMPREPLY=( $( poldek -l | awk "/^$cur/{print \$1}" ) ) | |
28 | return 0 | |
29 | ;; | |
30 | esac | |
31 | ||
32 | case "$cur" in | |
33 | --verify*=*,*) | |
34 | local p=${cur#--verify=*,} | |
35 | p=${p//\\} # those backslashes propagate!!! -- kill them | |
36 | # somewhy bash escapes equal sign, so we must match the backslash too | |
37 | COMPREPLY=( $( compgen -P "${p%,*}," -W 'deps conflicts file-conflicts file-orphans file-missing-deps' -- "${cur##*,}" ) ) | |
38 | return 0 | |
39 | ;; | |
40 | --verify*) | |
41 | # somewhy bash escapes equal sign, so we must match the backslash too | |
42 | COMPREPLY=( $( compgen -P --verify= -W 'deps conflicts file-conflicts file-orphans file-missing-deps' -- "${cur#--verify*=}" ) ) | |
43 | return 0 | |
44 | ;; | |
45 | --*) | |
46 | COMPREPLY=( $( compgen -W ' | |
47 | --mkidx --makeidx --mt --nocompress --nodesc --nodiff --notimestamp | |
48 | --dn --dt --sn --prefix --source --st --clean --clean-pkg | |
49 | --clean-whole --cleana --sl --stl --update --up --update-whole | |
50 | --upa --caplookup --pset --downgrade --install --reinstall | |
51 | --upgrade --install-dist --reinstall-dist --root --upgrade-dist | |
52 | --dump --dumpn --fetch --follow --force --fresh --greedy --hold | |
53 | --ignore --justdb --mercy --nodeps --nohold --noignore --nofollow | |
54 | --parsable-tr-summary --pm-force --pm-nodeps --pmopt --promoteepoch | |
55 | --uniq --test --erase --greedy --nodeps --nofollow --test --verify= | |
56 | --priconf --split --split-out --ask --cachedir --cmd --conf --log | |
57 | --noask --noconf --pmcmd --runas --shell --skip-installed --sudocmd | |
58 | --upconf --help --usage --version | |
59 | ' -- $cur ) ) | |
60 | ;; | |
61 | *) | |
62 | COMPREPLY=( $( compgen -W '-F -N -O -P -Q -V -e -i -l -m -n -q -r -s -t -u -v' -- $cur ) ) | |
63 | ;; | |
64 | esac | |
65 | ||
66 | return 0 | |
67 | } | |
68 | complete -F _poldek $nospace $filenames poldek | |
69 | ||
70 | } |