1 #Date: Wed, 31 Jan 2001 12:53:56 -0800
2 #From: Aaron Smith <aaron@mutex.org>
3 #To: freebsd-ports@freebsd.org
4 #Subject: useful bash completion function for pkg commands
5 #Message-ID: <20010131125356.G52003@gelatinous.com>
7 #hi all. i just wanted to share this bash completion function i wrote that
8 #completes package names for pkg_info and pkg_delete. i find this a great
9 #help when dealing with port management. programmed completion requires
16 cur=${COMP_WORDS[COMP_CWORD]}
18 if [[ $cur == '-' ]]; then
19 if [[ ${COMP_WORDS[0]} == 'pkg_info' ]]; then
20 COMPREPLY=(-a -c -d -D -i -k -r -R -p -L -q -I -m -v -e -l)
22 elif [[ ${COMP_WORDS[0]} == 'pkg_delete' ]]; then
23 COMPREPLY=(-v -D -d -n -f -p)
28 COMPREPLY=( $(compgen -d /var/db/pkg/$cur | sed sN/var/db/pkg/NNg) )
31 complete -F _pkg_func pkg_delete pkg_info