1
# Debian apt-get(8) completion.
6
local cur prev special i
9
_get_comp_words_by_ref cur prev
11
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
12
if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
13
special=${COMP_WORDS[i]}
17
if [ -n "$special" ]; then
19
remove|autoremove|purge)
20
if [ -f /etc/debian_version ]; then
22
COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
25
_rpm_installed_packages
30
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
31
2> /dev/null ) $( apt-cache dumpavail | \
32
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
36
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
48
-t|--target-release|--default-release)
49
COMPREPLY=( $( apt-cache policy | \
50
command grep "release.o=Debian,a=$cur" | \
51
sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
56
if [[ "$cur" == -* ]]; then
57
COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o \
58
--download-only --fix-broken --help --version --ignore-missing \
59
--fix-missing --no-download --quiet --simulate --just-print \
60
--dry-run --recon --no-act --yes --assume-yes --show-upgraded \
61
--only-source --compile --build --ignore-hold --target-release \
62
--no-upgrade --force-yes --print-uris --purge --reinstall \
63
--list-cleanup --default-release --trivial-only --no-remove \
64
--diff-only --no-install-recommends --tar-only --config-file \
65
--option --auto-remove' -- "$cur" ) )
67
COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
68
dist-upgrade install remove purge source build-dep \
69
check clean autoclean autoremove' -- "$cur" ) )
74
complete -F _apt_get -o filenames apt-get
76
# Debian apt-cache(8) completion.
81
local cur prev special i
84
_get_comp_words_by_ref cur prev
86
if [ "$cur" != show ]; then
87
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
88
if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
89
special=${COMP_WORDS[i]}
95
if [ -n "$special" ]; then
103
COMPREPLY=( $( apt-cache dumpavail | \
104
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
109
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) )
118
-c|-p|-s|--config-file|--pkg-cache|--src-cache)
123
if [[ "$cur" != -* ]]; then
129
if [[ "$cur" == -* ]]; then
131
COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
132
-o --help --version --pkg-cache --src-cache \
133
--quiet --important --full --all-versions \
134
--no-all-versions --generate --no-generate \
135
--names-only --all-names --recurse \
136
--config-file --option --installed' -- "$cur" ) )
139
COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
140
stats dump dumpavail unmet search search \
141
depends rdepends pkgnames dotty xvcg \
142
policy madison' -- "$cur" ) )
149
complete -F _apt_cache -o filenames apt-cache
154
# sh-indent-comment: t
155
# indent-tabs-mode: nil
157
# ex: ts=4 sw=4 et filetype=sh