diff options
author | Aaron Walker <ka0ttic@gentoo.org> | 2005-05-07 11:47:34 +0000 |
---|---|---|
committer | Aaron Walker <ka0ttic@gentoo.org> | 2005-05-07 11:47:34 +0000 |
commit | c95597f728bf77ea0155ca453f4e3b3703c6b0c4 (patch) | |
tree | 70b8cc8dd35be3de56d76f6b6f4e0d877afe39eb /gentoo | |
parent | Added _list_compgen thanks to TGL in previously mentioned bug. (diff) | |
download | gentoo-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-- | gentoo | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -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 |