* PATCH: _chown bug fix
@ 2002-01-03 12:37 Oliver Kiddle
0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2002-01-03 12:37 UTC (permalink / raw)
To: zsh-workers
_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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-01-03 12:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-03 12:37 PATCH: _chown bug fix Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).