diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2002-01-03 12:47:55 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2002-01-03 12:47:55 +0000 |
commit | 96de4d0740485b70e8e6210fd47e83c6a9bece0e (patch) | |
tree | 479b67d93325bad903c77613539a590d890acd26 /Completion/Unix | |
parent | e2f9689a3b5dadad62ffeefa56d83cd9b7c10e98 (diff) | |
download | zsh-96de4d0740485b70e8e6210fd47e83c6a9bece0e.tar.gz zsh-96de4d0740485b70e8e6210fd47e83c6a9bece0e.tar.xz zsh-96de4d0740485b70e8e6210fd47e83c6a9bece0e.zip |
16396: fix argument handling bugs
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Command/_chown | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index f5ff8f45e..2e55209c5 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 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 |