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/_groups19
1 files changed, 19 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_groups b/Completion/Unix/Type/_groups
new file mode 100644
index 000000000..a8d8ad068
--- /dev/null
+++ b/Completion/Unix/Type/_groups
@@ -0,0 +1,19 @@
+#compdef newgrp
+
+local expl groups tmp
+
+_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
+      else
+        : ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}}
+      fi
+
+  groups=( "$_cache_groups[@]" )
+fi
+
+_wanted groups expl group compadd "$@" -a groups