commit:     14ad3adb3606e7d7f7d538ae8f7cda2f8b11d93c
Author:     Tim Harder <radhermit <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 21 09:33:06 2014 +0000
Commit:     Tim Harder <radhermit <AT> gentoo <DOT> org>
CommitDate: Sun Dec 21 09:33:06 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/zsh-completion.git;a=commit;h=14ad3adb

split out arches list into it's own completion file

This might be combined later on with _gentoo_repos to form a _gentoo
file that accepts command args related to the completion function
requested.

---
 src/_gentoo_arches | 11 +++++++++++
 src/_portage_utils | 13 +------------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/_gentoo_arches b/src/_gentoo_arches
new file mode 100644
index 0000000..7206ea3
--- /dev/null
+++ b/src/_gentoo_arches
@@ -0,0 +1,11 @@
+#autoload
+
+local arches arch allarches
+
+arches=(${(f)"$(<$(_gentoo_repos -m)/profiles/arch.list)"})
+for arch in $arches; do
+  [[ $arch =~ '^[^#]' ]] && allarches+=( $arch )
+done
+_describe -t available-arches "arch" allarches
+
+# vim: ft=zsh sw=2 ts=2 et

diff --git a/src/_portage_utils b/src/_portage_utils
index cab73f9..3e483a6 100644
--- a/src/_portage_utils
+++ b/src/_portage_utils
@@ -19,17 +19,6 @@ case $service in
       {'(--compare)-c','(-c)--compare'}'[Compare two atoms]'
     ;;
   qcache)
-    local arch
-    local -a arches allarches
-
-    show_archs(){
-      arches=(${(f)"$(<$(_gentoo_repos -m)/profiles/arch.list)"})
-      for arch in $arches; do
-        [[ $arch =~ '^[^#]' ]] && allarches+=( $arch )
-      done
-      _describe -t available-arches "arch" allarches
-    }
-
     _arguments -s $common_args \
       {'(--matchpkg)-p','(-p)--matchpkg'}'[match pkgname]:package 
name:_gentoo_packages available_pkgnames_only' \
       {'(--matchcat)-c','(-c)--matchcat'}'[match 
catname]:category:_gentoo_packages category' \
@@ -39,7 +28,7 @@ case $service in
       {'(--stats)-s','(-s)--stats'}'[display statistics about the portage 
tree]' \
       {'(--all)-a','(-a)--all'}'[list packages that have at least one version 
keyworded for on a given arch]' \
       {'(--not)-n','(-n)--not'}"[list packages that aren't keyworded on a 
given arch]" \
-      '*:arch:show_archs'
+      '*:arch:_gentoo_arches'
     ;;
   qcheck)
     _arguments -s $common_args \

Reply via email to