From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on finch.gentoo.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=DMARC_NONE,MAILING_LIST_MULTI, RDNS_DYNAMIC autolearn=no autolearn_force=no version=4.0.0 Received: from lark.theleaf.office (cable-213-132-142-63.upc.chello.be [213.132.142.63]) by chiba.3jane.net (Postfix) with SMTP id 5AD37233C3 for ; Thu, 13 Dec 2001 06:35:37 -0600 (CST) Received: (qmail 25285 invoked from network); 13 Dec 2001 12:35:53 -0000 Received: from unknown (HELO willow.theleaf.office) (10.1.1.3) by 10.1.1.1 with SMTP; 13 Dec 2001 12:35:53 -0000 From: Geert Bevin To: gentoo-dev@gentoo.org Content-Type: multipart/mixed; boundary="=-EnqEF2/+WAQYg4mGFO+i" X-Mailer: Evolution/1.0 (Preview Release) Date: 13 Dec 2001 13:34:56 +0100 Message-Id: <1008246896.1016.10.camel@willow.theleaf.office> Mime-Version: 1.0 Subject: [gentoo-dev] updated emerge bash completion + question Sender: gentoo-dev-admin@gentoo.org Errors-To: gentoo-dev-admin@gentoo.org X-BeenThere: gentoo-dev@gentoo.org X-Mailman-Version: 2.0.6 Precedence: bulk Reply-To: gentoo-dev@gentoo.org List-Help: List-Post: List-Subscribe: , List-Id: Developer discussion list List-Unsubscribe: , List-Archive: X-Archives-Salt: 33a576d6-de5e-4908-8aaf-4bb5022b7c19 X-Archives-Hash: 49dad1aa6848c6c93a31b17155e0b9d1 --=-EnqEF2/+WAQYg4mGFO+i Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi all, here is a slightly updated emerge bash completion which also completes the arguments now and adds 'update' and 'system' to the completions. I have one problem though. emerge --usepkg should complete on files. Normally a command that completes on files is defined with 'complete -f command'. The bash info says that the 'comspec' builtin which is used to generate completion matches generates those matches in the same way as 'complete', however when using 'comspec -f' the filename completion stops after one path element and doesn't continue until a file has been reached. Does someone know how to work around this? Geert. -- Geert Bevin the Leaf sprl/bvba "Use what you need" Pierre Theunisstraat 1/47 http://www.theleaf.be 1030 Brussels gbevin@theleaf.be Tel & Fax +32 2 241 19 98 --=-EnqEF2/+WAQYg4mGFO+i Content-Disposition: attachment; filename=emerge.completion Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1 # Gentoo emerge completion. # _emerge() { local cur prev grepcmd sedcmd systemactions setsma setbig COMPREPLY=3D() cur=3D${COMP_WORDS[COMP_CWORD]} prev=3D${COMP_WORDS[COMP_CWORD-1]} if [ $COMP_CWORD -eq 1 ] && [[ "$cur" =3D=3D -* ]]; then COMPREPLY=3D( $( compgen -W '--pretend \ --autoclean \ --usepkg \ --buildpkg' | grep ^$cur ) ) elif [ "$prev" =3D=3D "--usepkg" ]; then COMPREPLY=3D( $( compgen -f $cur ) ) else cd /usr/portage grepcmd=3D"grep -E ^$cur.*" sedcmd=3D"sed -e /CVS/d \ -e /BUGS-TODO/d \ -e /ChangeLog.*/d \ -e /header.txt/d \ -e /skel.build/d \ -e /distfiles/d \ -e /eclass/d \ -e /files/d \ -e /incoming/d \ -e /packages/d \ -e /profiles/d \ -e /scripts/d" systemactions=3D$'\n'"system"$'\n'"upgrade" setsma=3D"`compgen -S '/' -G "*" | $sedcmd`"$systemactions setbig=3D"`compgen -G "*/*" | $sedcmd`"$systemactions if [ $cur ]; then if [ `echo $cur | grep '/'` ]; then COMPREPLY=3D( $( echo "$setbig" | $grepcmd ) ) else if [ `echo "$setsma" | $grepcmd | grep '/' | wc -l` =3D 1 ]; then COMPREPLY=3D( $( echo "$setbig" | $grepcmd ) ) else COMPREPLY=3D( $( echo "$setsma" | $grepcmd ) ) fi fi else COMPREPLY=3D( $( echo "$setsma" ) ) fi fi =09 return 0 } complete -F _emerge emerge --=-EnqEF2/+WAQYg4mGFO+i--