]> TLD Linux GIT Repositories - packages/bash-completion.git/blob - bash-completion-poldek.sh
- TLDized
[packages/bash-completion.git] / bash-completion-poldek.sh
1 # poldek(1) completion
2 #
3 _poldek()
4 {
5         local cur prev
6         cur=${COMP_WORDS[COMP_CWORD]}
7
8         COMPREPLY=()
9
10         case "${COMP_WORDS[1]}" in
11         -@(e|-erase))
12                 if [[ "$cur" == -* ]]; then
13                         COMPREPLY=( $( compgen -W '--nodeps --nofollow --test' -- $cur ) )
14                 else
15                         _xfunc rpm _rpm_installed_packages
16                 fi
17                 return 0
18                 ;;
19         esac
20
21         prev=${COMP_WORDS[COMP_CWORD-1]}
22
23         case "$prev" in
24         -@(n|-sn))
25                 COMPREPLY=( $( poldek -l | awk "/^$cur/{print \$1}" ) )
26                 return 0
27                 ;;
28         esac
29
30         case "$cur" in
31         --verify*=*,*)
32                 local p=${cur#--verify=*,}
33                 p=${p//\\} # those backslashes propagate!!! -- kill them
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                 ;;
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
53                 --uniq --test --erase --greedy --nodeps --nofollow --test --verify=
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         *)
60                 COMPREPLY=( $( compgen -W '-F -N -O -P -Q -V -e -i -l -m -n -q -r -s -t -u -v' -- $cur ) )
61                 ;;
62         esac
63
64         return 0
65 } &&
66 complete -F _poldek $nospace $filenames poldek