diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2015-05-05 23:32:59 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2015-05-05 23:58:59 +0200 |
commit | db38e167634b6c2217eec3a5aafc37c46d9e5a8d (patch) | |
tree | daa342d423febbd3a5a7ef97053037677fab004a /Completion/Unix/Command/_chown | |
parent | 01eea47617a6e06debdb4330f92ae69f92089fd2 (diff) | |
parent | 3c3c8d3d13fd4cf6c03f81ca8dc18a1efd561728 (diff) | |
download | zsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.tar.gz zsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.zip |
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_chown')
-rw-r--r-- | Completion/Unix/Command/_chown | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index b4539315d..641b5a773 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -1,29 +1,42 @@ -#compdef chown chgrp +#compdef chown chgrp zf_chown=chown zf_chgrp=chgrp local curcontext="$curcontext" state line expl ret=1 -local suf usr grp req deref args +local suf usr grp req deref pattern arg args if _pick_variant gnu=Free\ Soft unix --version; then args=( '(-c --changes -v --verbose)'{-c,--changes}'[report each change made]' '(-c --changes -v --verbose)'{-v,--verbose}'[output info for every file processed]' '(-h --no-dereference)--dereference[dereference symlinks]' - '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks them self]' + '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks themselves]' '(-f --silent --quiet)'{-f,--silent,--quiet}"[don't report errors]" + '--preserve-root[fail to operate recursively on /]' '--reference=[copy ownership of specified file]:file:_files' '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]' + '(-H -L -P)-L[follow all symlinks]' + '(-H -L -P)-H[follow symlinks on the command line]' + '(-H -L -P)-P[do not follow symlinks (default)]' '(- : *)--help[display help information]' '(- : *)--version[display version information]' ) [[ $service = chown ]] && args+=( '--from=[restrict changes to files by current ownership]: :->owner' ) else - # based on $OSTYPE = solaris2.8 args=( "-f[don't report errors]" "-h[operate on symlinks them self]" '-R[change files and directories recursively]' + '(-H -L -P)-L[follow all symlinks]' + '(-H -L -P)-H[follow symlinks on the command line]' + '(-H -L -P)-P[do not follow symlinks (default)]' ) + for pattern arg in \ + 'freebsd*' "-x[don't traverse file systems]" \ + '(darwin|dragonfly|(free|net)bsd)*' '-v[output info for every file processed]' \ + 'solaris2.<11->' '-s[owner and/or group are Windows SID strings]' + do + [[ $OSTYPE = $~pattern ]] && args+=( $arg ) + done fi (( $+words[(r)--reference*] )) || args+=( '(--reference)1: :->owner' ) @@ -32,8 +45,8 @@ _arguments -C -s "$args[@]" '*:files:->files' && ret=0 case $state in owner) if [[ $service = chgrp ]] || compset -P '*[:.]'; then - if (( EGID && $+commands[groups] )); then # except for root - _wanted groups expl 'group' compadd $(groups) && return 0 + if (( EGID && $+commands[groups] && ! $+funcstack[(r)_sudo] )); then # except for root + _wanted groups expl 'group' compadd $(groups) && return 0 fi _groups && ret=0 else |