diff options
author | Oliver Kiddle <opk@zsh.org> | 2015-05-03 16:53:47 +0200 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2015-05-03 16:53:57 +0200 |
commit | ab7ec8d9851fea8230e1ccfba284c5bfaf457d88 (patch) | |
tree | 837b14c838b96728ebdb530eb20d35737ef8419b /Completion/Unix/Command/_id | |
parent | b29278c69a67089ba225a98478069eb3f32ab4e6 (diff) | |
download | zsh-ab7ec8d9851fea8230e1ccfba284c5bfaf457d88.tar.gz zsh-ab7ec8d9851fea8230e1ccfba284c5bfaf457d88.tar.xz zsh-ab7ec8d9851fea8230e1ccfba284c5bfaf457d88.zip |
35011: update completions for some common Unix commands,
in particular improving FreeBSD support
Diffstat (limited to 'Completion/Unix/Command/_id')
-rw-r--r-- | Completion/Unix/Command/_id | 60 |
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 |