* [gentoo-dev] emerge, ebuild and rc-update bash completion
@ 2001-12-14 11:32 Geert Bevin
0 siblings, 0 replies; only message in thread
From: Geert Bevin @ 2001-12-14 11:32 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
Hi all,
added the completions for ebuild and rc-update, and made the completion
for emerge quite a bit faster.
Enjoy !
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
[-- Attachment #2: gentoo.completion --]
[-- Type: text/plain, Size: 2502 bytes --]
# Gentoo linux command completion.
#
_emerge()
{
local cur prev grepcmd sedcmd systemactions setsma setbig portagedir
portagedir=/usr/portage
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--pretend \
--autoclean \
--usepkg \
--buildpkg' | grep ^$cur ) )
elif [ "$prev" == "--usepkg" ]; then
COMPREPLY=( $( compgen -f $cur ) )
else
cd ${portagedir}
grepcmd="grep -E ^$cur.*"
sedcmd="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=$'\n'"system"$'\n'"update"
if [ $cur ]; then
if [ `echo $cur | grep '/'` ]; then
setbig="`compgen -G "$cur*" | $sedcmd`"$systemactions
COMPREPLY=( $( echo "$setbig" | $grepcmd ) )
else
setsma="`compgen -S '/' -G "$cur*" | $sedcmd`"$systemactions
if [ `echo "$setsma" | $grepcmd | grep '/' | wc -l` = 1 ]; then
setbig="`compgen -G "*/*" | $sedcmd`"$systemactions
COMPREPLY=( $( echo "$setbig" | $grepcmd ) )
else
COMPREPLY=( $( echo "$setsma" | $grepcmd ) )
fi
fi
else
setsma="`compgen -S '/' -G "$cur*" | $sedcmd`"$systemactions
COMPREPLY=( $( echo "$setsma" ) )
fi
fi
return 0
}
complete -F _emerge emerge
_ebuild()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -f $cur ) )
elif [ $COMP_CWORD -eq 2 ]; then
COMPREPLY=( $( compgen -W 'clean \
compile \
fetch \
install \
merge \
package \
qmerge \
remerge \
rpm \
unmerge \
unpack' $cur ) )
fi
return 0
}
complete -F _ebuild ebuild
_rc-update()
{
local cur prev initdir runlvdir
initdir=/etc/init.d/
runlvdir=/etc/runlevels/
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'add del' $cur ) )
elif [ $COMP_CWORD -eq 2 ]; then
cd $initdir
COMPREPLY=( $( compgen -G "$cur*" ) )
elif [ $COMP_CWORD -eq 3 ]; then
cd $runlvdir
COMPREPLY=( $( compgen -G "$cur*" ) )
fi
return 0
}
complete -F _rc-update rc-update
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-12-14 11:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-14 11:32 [gentoo-dev] emerge, ebuild and rc-update bash completion Geert Bevin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox