about summary refs log tree commit diff
path: root/Completion/Unix/Type/_groups
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Type/_groups')
-rw-r--r--Completion/Unix/Type/_groups11
1 files changed, 7 insertions, 4 deletions
diff --git a/Completion/Unix/Type/_groups b/Completion/Unix/Type/_groups
index bbb80868b..b6d599c28 100644
--- a/Completion/Unix/Type/_groups
+++ b/Completion/Unix/Type/_groups
@@ -6,11 +6,14 @@ _tags groups || return 1
 
 if ! zstyle -a ":completion:${curcontext}:" groups groups; then
   (( $+_cache_groups )) ||
-      if (( ${+commands[ypcat]} )) &&
-	  tmp=$(_call_program groups ypcat group.byname 2>/dev/null); then
-        : ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP
+      if (( ${+commands[getent]} )); then
+        : ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent group 2>/dev/null)}%%:*}}
       else
-        : ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}}
+        : ${(A)_cache_groups:=${${${(s: :)$(</etc/group)}%%:*}:#+}}
+	if (( ${+commands[ypcat]} )) &&
+	    tmp=$(_call_program groups ypcat group.byname 2>/dev/null); then
+          _cache_groups+=( ${${(f)tmp}%%:*} ) # If you use YP
+	fi
       fi
 
   groups=( "$_cache_groups[@]" )