Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _chown bug fix
- X-seq: zsh-workers 16396
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: _chown bug fix
- Date: Thu, 03 Jan 2002 12:37:29 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: kiddleo@xxxxxxxxxxxxxxxxx
_chown suffers a similar problem to the recent _zip one with options
not being well handled when picking out previous arguments. This now
fixes that.
Oliver
Index: Completion/Unix/Command/_chown
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_chown,v
retrieving revision 1.4
diff -u -r1.4 _chown
--- Completion/Unix/Command/_chown 2001/08/03 16:53:26 1.4
+++ Completion/Unix/Command/_chown 2002/01/03 12:32:40
@@ -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 @@
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
This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a pro-active anti-virus service working around the clock, around the globe visit http://www.messagelabs.com/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author