about summary refs log tree commit diff
path: root/Completion/User
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User')
-rw-r--r--Completion/User/_chown15
-rw-r--r--Completion/User/_groups6
2 files changed, 21 insertions, 0 deletions
diff --git a/Completion/User/_chown b/Completion/User/_chown
new file mode 100644
index 000000000..1ec76b39e
--- /dev/null
+++ b/Completion/User/_chown
@@ -0,0 +1,15 @@
+#compdef chown chgrp
+
+if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
+  if [[ $words[1] = chgrp ]] || compset -P '*[:.]'; then
+    _groups
+  else
+    if [[ $OSTYPE = (solaris*|hpux*) ]]; then
+      compgen -u -S ':' -q
+    else
+      compgen -u -S '.' -q
+    fi
+  fi
+else
+  _files
+fi
diff --git a/Completion/User/_groups b/Completion/User/_groups
new file mode 100644
index 000000000..975189174
--- /dev/null
+++ b/Completion/User/_groups
@@ -0,0 +1,6 @@
+#compdef newgrp
+
+: ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}}
+# : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use NIS
+
+compadd $groups