source: vendor/bash/3.1-p17/examples/complete/complete.freebsd

Last change on this file was 3228, checked in by bird, 18 years ago

bash 3.1

File size: 987 bytes
Line 
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>
6
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
10#bash-2.04.
11
12_pkg_func ()
13{
14 local cur
15
16 cur=${COMP_WORDS[COMP_CWORD]}
17
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)
21 return 0;
22 elif [[ ${COMP_WORDS[0]} == 'pkg_delete' ]]; then
23 COMPREPLY=(-v -D -d -n -f -p)
24 return 0;
25 fi
26 fi
27
28 COMPREPLY=( $(compgen -d /var/db/pkg/$cur | sed sN/var/db/pkg/NNg) )
29 return 0
30}
31complete -F _pkg_func pkg_delete pkg_info
Note: See TracBrowser for help on using the repository browser.