about summary refs log tree commit diff
path: root/Completion/User/_groups
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-22 12:29:47 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-22 12:29:47 +0000
commit3d9d13e918c195f974ff7b2f1dc5b65f6b20a441 (patch)
treed571aef9c8152287ed94dae1199108de80f0b984 /Completion/User/_groups
parenta76b36928c5cbeef3fe015ca30bbf910ab2a107e (diff)
downloadzsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.tar.gz
zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.tar.xz
zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.zip
zsh-workers/8720
Diffstat (limited to 'Completion/User/_groups')
-rw-r--r--Completion/User/_groups19
1 files changed, 11 insertions, 8 deletions
diff --git a/Completion/User/_groups b/Completion/User/_groups
index f1963a8e7..0007c1791 100644
--- a/Completion/User/_groups
+++ b/Completion/User/_groups
@@ -1,15 +1,18 @@
 #compdef newgrp
 
-local expl
+local expl groups
 
 _wanted groups expl group || return 1
 
-if (( ! $+groups )); then
-  if (( ${+commands[ypcat]} )); then
-    : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use YP
-  else
-    : ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}}
-  fi
+if ! _style -a groups groups groups; then
+  (( $+_cache_groups )) ||
+      if (( ${+commands[ypcat]} )); then
+        : ${(A)_cache_groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use YP
+      else
+        : ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}}
+      fi
+
+  groups=( "$_cache_groups[@]" )
 fi
 
-compadd "$@" "$expl[@]" - $groups
+compadd "$@" "$expl[@]" - "$groups[@]"