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