Use eix instead of emerge when possible

On Gentoo the eix program is MUCH faster than emerge for listing package
names.  I've left the emerge code in as a 2nd choice because not every
Gentoo system has eix installed (although they should).  Also,  the
emerge code didn't seem to produce any output on my system.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
This commit is contained in:
James Bowlin 2010-12-02 01:33:56 +08:00 committed by Grissiom
parent 6a5d6471c5
commit 46986ad4c2

View File

@ -46,9 +46,17 @@ function __fish_print_packages
# This completes the package name from the portage tree.
# True for installing new packages. Function for printing
# installed on the system packages is in completions/emerge.fish
if type -f emerge >/dev/null
emerge -s \^(commandline -tc) |sgrep "^*" |cut -d\ -f3 |cut -d/ -f2
# eix is MUCH faster than emerge so use it if it is available
if type -f eix > /dev/null
eix --only-names "^"(commandline -tc) | cut -d/ -f2
return
else
# FIXME? Seems to be broken
if type -f emerge >/dev/null
emerge -s \^(commandline -tc) |sgrep "^*" |cut -d\ -f3 |cut -d/ -f2
return
end
end
end