summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command/_chown
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-03-25 16:39:09 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-03-25 16:39:09 +0000
commit60aaa6c2699a6954419fc7f2a8445b2f92c5793d (patch)
tree66b8fd38222858138fddf57477265aa2a26ed93b /Completion/Unix/Command/_chown
parentmerge changes from 4.1 (diff)
downloadzsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.tar
zsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.tar.gz
zsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.tar.bz2
zsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.tar.lz
zsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.tar.xz
zsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.tar.zst
zsh-60aaa6c2699a6954419fc7f2a8445b2f92c5793d.zip
merge changes from 4.1
Diffstat (limited to 'Completion/Unix/Command/_chown')
-rw-r--r--Completion/Unix/Command/_chown16
1 files changed, 10 insertions, 6 deletions
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index f5ff8f45e..599e09d14 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -1,8 +1,12 @@
#compdef chown chgrp
-local suf usr grp req expl
+local suf usr grp req expl line
-if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
+line=( "${(@)words[2,CURRENT-1]:#-*}" )
+
+if [[ -prefix - ]]; then
+ _message -e options option
+elif [[ $#line -eq 0 ]]; then
if [[ $service = chgrp ]] || compset -P '*[:.]'; then
if (( EGID && $+commands[groups] )); then # except for root
_wanted groups expl 'group' compadd $(groups) && return 0
@@ -19,16 +23,16 @@ if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
fi
else
if [[ $service = chgrp ]]; then
- grp=${words[CURRENT-1]}
+ grp=${line[1]}
else
- usr=${words[CURRENT-1]%%[.:]*}
+ usr=${line[1]%%[.:]*}
usr=${${(M)usr:#[0-9]#}:-${userdirs[$usr]:+.$usr.}}
- grp=${${(M)words[CURRENT-1]%%[.:]*}#?}
+ grp=${${(M)line[1]%%[.:]*}#?}
fi
[[ -n $grp ]] && grp="${${(M)grp:#[0-9]#}:-.$grp.}"
req=( ${usr:+\^u$usr} ${grp:+\^g$grp} )
(( EUID )) && req=( u$EUID$^req )
req=( -$^req )
- _files -g "*(${(j:,:)req})" && return 0
+ _wanted files expl file _files -g "*(${(j:,:)req})" && return 0
fi