- many Debian command updates from Rafael Sepúlveda <drs@gnulinux.org.mx>

This commit is contained in:
ianmacd 2002-10-02 01:32:40 +00:00
parent d4e5b1137b
commit 98dee7dfa6

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b # bash_completion - some programmable completion functions for bash 2.05b
# #
# $Id: bash_completion,v 1.420 2002/10/01 09:06:01 ianmacd Exp $ # $Id: bash_completion,v 1.421 2002/10/02 03:32:40 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1435,6 +1435,7 @@ _apt_get()
special=${COMP_WORDS[i]} special=${COMP_WORDS[i]}
fi fi
done done
if [ -n "$special" ]; then if [ -n "$special" ]; then
case $special in case $special in
@(install|source|build-dep)) @(install|source|build-dep))
@ -1455,30 +1456,36 @@ _apt_get()
esac esac
fi fi
if [[ "$prev" == -*c ]] || [ "$prev" = --config-file ]; then case "$prev" in
_filedir -@(c|-config-file))
_filedir
return 0
;;
elif [[ "$prev" == -*h ]] || [ "$prev" = --help ]; then -@(t|-target-release|-default-release))
return 0 COMPREPLY=( $( apt-cache policy | \
grep "release.o=Debian,a=$cur" | \
else sed -e "s/.*a=\(\w*\).*/\1/" | uniq ) )
return 0
;;
*)
COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \ COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
dist-upgrade install remove source \ dist-upgrade install remove source build-dep \
build-dep check clean autoclean \ check clean autoclean -d -f -h -v -m -q -s -y \
-d -f -h -v -m -q -s -y -u -b -c -o -t \ -u -t -b -c -o --download-only --fix-broken \
--download-only --fix-broken --help \ --help --version --ignore-missing \
--version --ignore-missing --fix-missing \ --fix-missing --no-download --quiet --simulate \
--no-download --quiet --simulate \ --just-print --dry-run --recon --no-act --yes \
--just-print --dry-run --recon --no-act \ --assume-yes --show-upgraded --only-source \
--yes --assume-yes --show-upgraded \ --compile --build --ignore-hold \
--compile --build --ignore-hold \ --target-release --no-upgrade --force-yes \
--no-upgrade --force-yes --print-uris \ --print-uris --purge --reinstall \
--purge --reinstall --list-cleanup \ --list-cleanup --default-release \
--target-release --default-release \ --trivial-only --no-remove --diff-only \
--trivial-only --no-remove --diff-only \ --tar-only --config-file --option' -- $cur ) )
--only-source --diff-only --tar-only \ ;;
--config-file --option' -- $cur ) ) esac
fi
return 0 return 0
} }
@ -1497,17 +1504,18 @@ _apt_cache()
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(add|show?(pkg)|depends|dotty) ]]; then if [[ ${COMP_WORDS[i]} == @(add|show?(pkg)|depends|dotty|policy) ]]; then
special=${COMP_WORDS[i]} special=${COMP_WORDS[i]}
fi fi
done done
if [ -n "$special" ]; then if [ -n "$special" ]; then
case $special in case $special in
add) add)
_filedir _filedir
return 0 return 0
;; ;;
show?(pkg)|depends|dotty) show?(pkg)|depends|dotty|policy)
COMPREPLY=( $( apt-cache pkgnames $cur ) ) COMPREPLY=( $( apt-cache pkgnames $cur ) )
return 0 return 0
;; ;;
@ -1515,17 +1523,24 @@ _apt_cache()
fi fi
if [[ "$prev" == -*c ]] || [ "$prev" = --config-file ]; then case "$prev" in
_filedir -@(c|p|s|-config-file|-@(pkg|src)-cache))
else _filedir
return 0
;;
*)
COMPREPLY=( $( compgen -W 'add gencaches showpkg stats dump \ COMPREPLY=( $( compgen -W 'add gencaches showpkg stats dump \
dumpavail unmet check search show dotty \ dumpavail unmet check search show dotty policy \
depends pkgnames -h -v -p -s -q -i -f -a -g -c \ depends pkgnames -h -v -p -s -q -i -f -a -g -c \
-o --help --version --pkg-cache --src-cache \ -o --help --version --pkg-cache --src-cache \
--quiet --important --full --all-versions \ --quiet --important --full --all-versions \
--no-generate --names-only --all-names \ --generate --no-generate --names-only \
--config-file --option' -- $cur ) ) --all-names --config-file --option \
fi --recurse' -- $cur ) )
;;
esac
return 0 return 0
} }
@ -1593,7 +1608,6 @@ _aptitude()
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) ) COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
else else
@ -1609,6 +1623,7 @@ complete -F _aptitude $default aptitude
# Debian apt-build(1) completion. # Debian apt-build(1) completion.
# #
have apt-build && have apt-build &&
_apt_build()
{ {
local cur prev special i local cur prev special i
@ -1639,24 +1654,29 @@ have apt-build &&
esac esac
fi fi
if [[ "$prev" == --@(patch|repository-dir) ]]; then case "$prev" in
_filedir
return 0
elif [[ "$prev" == -@(*h|-@(patch-strip|build-@(dir|command)|help)) ]]; then
return 0
else
COMPREPLY=( $( compgen -W "update upgrade install remove \
source dist-upgrade world clean info \
--help --show-upgraded -u --build-dir \
--repository-dir --build-only \
--build-command --reinstall --rebuild \
--remove-builddep --no-wrapper --purge \
--reinstall --rebuild --remove-builddep \
--no-wrapper --purge --build-command \
--patch --patch-strip -p --yes -y \
--version -v --no-source" -- $cur ) )
fi
--@(patch|build-dir|repository-dir))
_filedir
return 0
;;
-@(h|-help))
return 0
;;
*)
COMPREPLY=( $( compgen -W "update upgrade install remove \
source dist-upgrade world clean info \
clean-repository update-repository \
--help --show-upgraded -u --build-dir \
--repository-dir --build-only \
--build-command --reinstall --rebuild \
--remove-builddep --no-wrapper --purge \
--patch --patch-strip -p --yes -y \
--version -v --no-source" -- $cur ) )
;;
esac
return 0 return 0
} }
@ -2802,30 +2822,28 @@ _dpkg()
fi fi
case "$prev" in case "$prev" in
-i|--install|--unpack|-A|--record-avail|-c|--contents|-I|--info| \ -@(i|A|I|f|e|X|-@(install|unpack|record-avail|contents|info| \
--fsys-tarfile|-f|--field|-e|--control|-X|--extract) fsys-tarfile|field|control|extract)))
_filedir 'deb' _filedir 'deb'
return 0 return 0
;; ;;
-b|--build) -@(b|-build))
_filedir -d _filedir -d
return 0 return 0
;; ;;
-s|--status|-p|--print-avail|-l|--list) -@(s|p|l|-@(status|print-avail|list)))
COMPREPLY=( $( apt-cache pkgnames $cur ) ) COMPREPLY=( $( apt-cache pkgnames $cur ) )
return 0 return 0
;; ;;
-S|--search) -@(S|-search))
_filedir _filedir
return 0 return 0
;; ;;
-r|--remove|--purge|-L|--listfiles) -@(r|L|-@(remove|purge|listfiles)))
COMPREPLY=( $( _comp-dpkg-installed-packages $cur ) ) COMPREPLY=( $( _comp-dpkg-installed-packages $cur ) )
return 0 return 0
;; ;;
*) *)
;;
esac
COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \ COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
--configure -r --remove --purge --get-selections \ --configure -r --remove --purge --get-selections \
@ -2852,6 +2870,10 @@ _dpkg()
-b --build -I --info -f --field -c --contents \ -b --build -I --info -f --field -c --contents \
-x --extract -X --vextract --fsys-tarfile -e --control \ -x --extract -X --vextract --fsys-tarfile -e --control \
--ignore-depends= --abort-after' -- $cur ) ) --ignore-depends= --abort-after' -- $cur ) )
;;
esac
} }
complete -F _dpkg $filenames dpkg dpkg-deb complete -F _dpkg $filenames dpkg dpkg-deb
} }
@ -2903,16 +2925,22 @@ _dselect()
cur=${COMP_WORDS[COMP_CWORD]} cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "$prev" = --admindir ]; then case "$prev" in
_filedir -d --admindir)
elif [[ "$prev" == -*D ]] || [ "$prev" = --debug ]; then _filedir -d
_filedir ;;
else
COMPREPLY=( $( compgen -W 'access update select install \ -@(D|debug))
_filedir
;;
*)
COMPREPLY=( $( compgen -W 'access update select install \
config remove quit --admindir --help \ config remove quit --admindir --help \
--version --licence --license --expert \ --version --licence --license --expert \
--debug' -- $cur ) ) --debug' -- $cur ) )
fi ;;
esac
return 0 return 0
} }