commit:     48adce4356f46eda30265d2c5a6cb4055c16c5e3
Author:     Louis Sautier <sautier.louis <AT> gmail <DOT> com>
AuthorDate: Sun Jun 10 16:26:46 2018 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Sat Jun 23 22:23:00 2018 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-bashcomp.git/commit/?id=48adce43

emerge: add support for sets completion.

Based on Marco Genasci's patch and slightly modified to get rid of the
unnecessary call to xargs.

Courtesy of Marco Genasci <fedeliallalinea <AT> gmail.com>.

Closes: https://bugs.gentoo.org/235454
Closes: https://github.com/gentoo/gentoo-bashcomp/pull/4

 completions/emerge | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/completions/emerge b/completions/emerge
index d7da227..03cc503 100644
--- a/completions/emerge
+++ b/completions/emerge
@@ -26,6 +26,12 @@ _emerge()
         return 0
     fi
 
+    if [[ ${cur} =~ ^@ ]] ; then
+        local SET_LIST=($(emerge --list-sets))
+        COMPREPLY=($(compgen -W '${SET_LIST[@]/#/@}' ${cur}))
+        return 0
+    fi
+
     # find action
     for x in ${COMP_LINE} ; do
         if [[ ${x} =~ ^(system|world)$ ]] || [[ ${x} =~ -[CPcs] ]] || \

Reply via email to