about summary refs log tree commit diff
path: root/Completion/Unix/Type/_groups
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-05-03 02:49:38 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-05-03 02:49:38 +0000
commit26785dfe6b5e36e520934585f91aaa44704bba75 (patch)
tree40f0c08763ae2cf9acff5fd2d578fb5ce197f7c8 /Completion/Unix/Type/_groups
parent4bf9b6583911e3c2163dd6317e32e2a0a76dc0ee (diff)
downloadzsh-26785dfe6b5e36e520934585f91aaa44704bba75.tar.gz
zsh-26785dfe6b5e36e520934585f91aaa44704bba75.tar.xz
zsh-26785dfe6b5e36e520934585f91aaa44704bba75.zip
Merge from trunk of files in 21315.
Diffstat (limited to 'Completion/Unix/Type/_groups')
-rw-r--r--Completion/Unix/Type/_groups24
1 files changed, 24 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_groups b/Completion/Unix/Type/_groups
new file mode 100644
index 000000000..923c34599
--- /dev/null
+++ b/Completion/Unix/Type/_groups
@@ -0,0 +1,24 @@
+#compdef newgrp groupdel
+
+local expl groups tmp
+
+_tags groups || return 1
+
+if ! zstyle -a ":completion:${curcontext}:" groups groups; then
+  (( $+_cache_groups )) ||
+      if [[ $OSTYPE = darwin* ]]; then
+        : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups lookupd -q group)"}:#name*}##*: }}
+      elif (( ${+commands[getent]} )); then
+        : ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent group 2>/dev/null)}%%:*}}
+      else
+        : ${(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[@]" )
+fi
+
+_wanted groups expl group compadd -a "$@" - groups