From ab7ec8d9851fea8230e1ccfba284c5bfaf457d88 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 3 May 2015 16:53:47 +0200 Subject: 35011: update completions for some common Unix commands, in particular improving FreeBSD support --- Completion/Unix/Command/_id | 60 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-) (limited to 'Completion/Unix/Command/_id') 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 -- cgit 1.4.1