about summary refs log tree commit diff
path: root/Completion/Unix/Command/_id
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_id')
-rw-r--r--Completion/Unix/Command/_id60
1 files changed, 48 insertions, 12 deletions
diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id
index 36cdf4c19..74fe6d9e1 100644
--- a/Completion/Unix/Command/_id
+++ b/Completion/Unix/Command/_id
@@ -1,13 +1,49 @@
-#compdef id
+#compdef id gid
 
-_arguments \
-  '-a[no-op]' \
-  '(-Z --context)'{-Z,--context}'[print only context]' \
-  '(-g --group)'{-g,--group}'[print only EGID]' \
-  '(-G --groups)'{-G,--groups}'[print all GIDs]' \
-  '(-n --name)'{-n,--name}'[print name instead of number]' \
-  '(-r --real)'{-r,--real}'[print real ID instead of effective]' \
-  '(-u --user)'{-u,--user}'[print only EUID]' \
-  '--help[display help]' \
-  '--version[display version]' \
-  ':user:_users'
+local args choices
+
+if _pick_variant gnu=GNU $OSTYPE --version; then
+  choices='--help --version -Z --context -g --group -G --groups -u --user'
+  _arguments \
+    "($choices)"{-Z,--context}'[print only security context]' \
+    "($choices)"{-g,--group}'[print only EGID]' \
+    "($choices -r --real)"{-G,--groups}'[print all GIDs]' \
+    '(-n --name --help --version)'{-n,--name}'[show name instead of number]' \
+    '(-r --real -g --groups --help --version)'{-r,--real}'[show real ID instead of effective]' \
+    "($choices)"{-u,--user}'[print only EUID]' \
+    '(-z --zero --help --version)'{-z,--zero}'[delimit entries with NUL characters]' \
+    '(- :)--help[display help information]' \
+    '(- :)--version[display version]' \
+    ':user:_users'
+else
+  choices="-A -a -c -G -g -M -p -P -u"
+  args=(
+    "($choices)-g[print only EGID]"
+    "($choices -r)-G[print all GIDs]"
+    "($choices)-u[print only EUID]"
+    '(-A -c -M -P)-n[show name instead of number]'
+    '(-A -c -M -P)-r[show real ID instead of effective]'
+  )
+  case $OSTYPE in
+    solaris*)
+      args+=(
+        '(-g -G -u -n -r)-a[show user name, user ID and all the groups]'
+	'(-g -G -u -n -r)-p[show project membership]'
+      )
+    ;;
+    darwin*|dragonfly*|freebsd*)
+      args+=( '(-)-P[print id in the form of a password file entry]' )
+    ;|
+    darwin*|freebsd*)
+      args+=(
+	'(-)-A[print process audit user ID]'
+	'(-)-M[print MAC label of the current process]'
+      )
+    ;|
+    freebsd*) args+=( '(-)-c[print current login class]' ) ;|
+    darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
+      args+=( '(-)-p[human readable output]' )
+    ;;
+  esac
+  _arguments -s $args ':user:_users'
+fi