]>
Commit | Line | Data |
---|---|---|
20998f4e ER |
1 | have poldek && { |
2 | ||
3 | # poldek(1) completion | |
ec8e3543 | 4 | # |
20998f4e ER |
5 | _poldek() |
6 | { | |
ec8e3543 | 7 | local cur prev |
a7d7bfcc | 8 | cur=${COMP_WORDS[COMP_CWORD]} |
20998f4e ER |
9 | |
10 | COMPREPLY=() | |
5ddbbf02 ER |
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 | ||
20998f4e | 23 | prev=${COMP_WORDS[COMP_CWORD-1]} |
20998f4e | 24 | |
a5640ce3 ER |
25 | case "$prev" in |
26 | -@(n|-sn)) | |
27 | COMPREPLY=( $( poldek -l | awk "/^$cur/{print \$1}" ) ) | |
28 | return 0 | |
29 | ;; | |
a5640ce3 | 30 | esac |
40c9869e | 31 | |
5ddbbf02 | 32 | case "$cur" in |
433751c0 ER |
33 | --verify*=*,*) |
34 | local p=${cur#--verify=*,} | |
c5fd8a89 | 35 | p=${p//\\} # those backslashes propagate!!! -- kill them |
433751c0 ER |
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 | ;; | |
5ddbbf02 ER |
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 | |
433751c0 | 55 | --uniq --test --erase --greedy --nodeps --nofollow --test --verify= |
5ddbbf02 ER |
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 | *) | |
c5fd8a89 | 62 | COMPREPLY=( $( compgen -W '-F -N -O -P -Q -V -e -i -l -m -n -q -r -s -t -u -v' -- $cur ) ) |
20998f4e ER |
63 | ;; |
64 | esac | |
65 | ||
66 | return 0 | |
67 | } | |
433751c0 ER |
68 | complete -F _poldek $nospace $filenames poldek |
69 | ||
20998f4e | 70 | } |