summaryrefslogtreecommitdiff
path: root/gentoo
diff options
context:
space:
mode:
authorAaron Walker <ka0ttic@gentoo.org>2005-05-07 11:47:34 +0000
committerAaron Walker <ka0ttic@gentoo.org>2005-05-07 11:47:34 +0000
commitc95597f728bf77ea0155ca453f4e3b3703c6b0c4 (patch)
tree70b8cc8dd35be3de56d76f6b6f4e0d877afe39eb /gentoo
parentAdded _list_compgen thanks to TGL in previously mentioned bug. (diff)
downloadgentoo-bashcomp-c95597f728bf77ea0155ca453f4e3b3703c6b0c4.tar.gz
gentoo-bashcomp-c95597f728bf77ea0155ca453f4e3b3703c6b0c4.tar.bz2
gentoo-bashcomp-c95597f728bf77ea0155ca453f4e3b3703c6b0c4.zip
Add support to _emerge for virtual/* completion
svn path=/trunk/; revision=52
Diffstat (limited to 'gentoo')
-rw-r--r--gentoo22
1 files changed, 20 insertions, 2 deletions
diff --git a/gentoo b/gentoo
index 58ac098..87d141f 100644
--- a/gentoo
+++ b/gentoo
@@ -622,7 +622,16 @@ _emerge()
eactions=$'\n'"clean"$'\n'"depclean"$'\n'"inject"$'\n'"prune"$'\n'"regen"$'\n'"search"$'\n'"unmerge"
fi
if [[ -n "${cur}" ]] ; then
- if [[ "${cur}" == */* ]] ; then
+ if [[ ${cur} == virtual/* ]] ; then
+ words=$(\
+ for pd in ${portdir} ; do \
+ if [[ -d ${pd}/profiles ]] ; then
+ find ${pd}/profiles -name virtuals -exec \
+ sed -n -e 's|^\(virtual/[[:alnum:]]\+\).*$|\1|p' {} \; | \
+ sort -u
+ fi ; \
+ done)
+ elif [[ ${cur} == */* ]] ; then
words=$(\
for pd in ${portdir} ; do \
builtin cd ${pd}; \
@@ -634,11 +643,20 @@ _emerge()
builtin cd ${pd} ; \
compgen -S '/' -G "${cur}*"; \
done)"${sysactions}""${eactions}"
+ # complete on virtuals
+ ww="${ww} $(\
+ for pd in ${portdir} ; do \
+ if [[ -d ${pd}/profiles ]] ; then
+ find ${pd}/profiles -name virtuals -exec \
+ sed -n -e 's|^\(virtual/[[:alnum:]]\+\).*$|\1|p' {} \; | \
+ sort -u
+ fi ; \
+ done)"
local w
for x in ${ww} ; do w="${x}\n${w}" ; done
- words=$(echo -e ${w} | uniq)
+ words=$(echo -e ${w} | sort -u)
local n=0
for i in ${words} ; do