From owner-freebsd-ports Wed Jan 31 12:54:13 2001 Delivered-To: freebsd-ports@freebsd.org Received: from cube.gelatinous.com (unknown [207.82.194.150]) by hub.freebsd.org (Postfix) with SMTP id 9F1A737B4EC for ; Wed, 31 Jan 2001 12:53:56 -0800 (PST) Received: (qmail 17850 invoked by uid 1000); 31 Jan 2001 20:53:56 -0000 Date: Wed, 31 Jan 2001 12:53:56 -0800 From: Aaron Smith To: freebsd-ports@freebsd.org Subject: useful bash completion function for pkg commands Message-ID: <20010131125356.G52003@gelatinous.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org hi all. i just wanted to share this bash completion function i wrote that completes package names for pkg_info and pkg_delete. i find this a great help when dealing with port management. programmed completion requires bash-2.04. _pkg_func () { local cur cur=${COMP_WORDS[COMP_CWORD]} if [[ $cur == '-' ]]; then if [[ ${COMP_WORDS[0]} == 'pkg_info' ]]; then COMPREPLY=(-a -c -d -D -i -k -r -R -p -L -q -I -m -v -e -l) return 0; elif [[ ${COMP_WORDS[0]} == 'pkg_delete' ]]; then COMPREPLY=(-v -D -d -n -f -p) return 0; fi fi COMPREPLY=( $(compgen -d /var/db/pkg/$cur | sed sN/var/db/pkg/NNg) ) return 0 } complete -F _pkg_func pkg_delete pkg_info -- aaron@mutex.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message