Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _arguments (was: Re: PATCH: Updated _rpm, but a bug with _arguments and: make check failure with latest CVS)
- X-seq: zsh-workers 11647
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: _arguments (was: Re: PATCH: Updated _rpm, but a bug with _arguments and: make check failure with latest CVS)
- Date: Tue, 30 May 2000 09:46:40 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Tue, 30 May 2000 05:54:16 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On May 30, 3:19am, Bart Schaefer wrote:
> } Subject: PATCH: Updated _rpm, but a bug with _arguments
> }
> } As of the current CVS sources (_arguments revision 1.25) completion for rpm
> } doesn't work any longer:
> }
> } zagzig[24] rpm --rc<TAB>
> } Completing no arguments
> } (beep)
>
> It's actually much worse than this; option completion is entirely broken
> when there's anything in the current word other than the leading hyphens.
> The culprits seem to be the following two hunks of 11624; for example, if
> I delete the `&& !line[2]' then completion after two hyphens and an alpha-
> numeric starts working again, but one hyphen and an alphanum still fails.
Yep, they should only be used when we have multiple sets. Sorry.
The patch also moves the rpm-query-comments because they made _rpm
fail for me.
Vin Shelton wrote:
> I'm getting the following error from 'make check':
>
> /usr/local/src/zsh-2000-05-29/Test/52zregexparse.ztst: all tests successful.
> *** /tmp/zsh.ztst.out.12028 Mon May 29 14:55:41 2000
> --- /tmp/zsh.ztst.tout.12028 Mon May 29 14:55:41 2000
> ***************
> *** 1,2 ****
> ! line: {tst -}{}
> ! MESSAGE:{arg}
> --- 1 ----
> ! line: {tst -x }{}
> Test /usr/local/src/zsh-2000-05-29/Test/53completion.ztst failed: output differs from expected as shown above for:
> comptesteval 'compdef _tst tst; _tst () { _arguments "-x" ":arg:" }'
> comptest $'tst -\t'
> Was testing: _arguments
> /usr/local/src/zsh-2000-05-29/Test/53completion.ztst: test failed.
This had to do with _arguments, too. And with _message. Or something.
Since _message doesn't add a dummy match anymore, the message isn't
shown. For now I've just changed the test, but I've put it onto my
list and will fix it after 3.1.7, together with the other things I
mentioned in 11565.
Bye
Sven
Index: Completion/Base/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.25
diff -u -r1.25 _arguments
--- Completion/Base/_arguments 2000/05/29 09:15:14 1.25
+++ Completion/Base/_arguments 2000/05/30 07:44:50
@@ -319,6 +319,7 @@
compadd -QqS= - "${PREFIX}${SUFFIX}"
else
tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" )
+ [[ "$PREFIX" != --* ]] && tmp1=( "${(@)tmp1:#--*}" )
tmp3=( "${(M@)tmp1:#[-+]?[^:]*}" )
tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.10
diff -u -r1.10 _rpm
--- Completion/Linux/_rpm 2000/05/30 03:54:36 1.10
+++ Completion/Linux/_rpm 2000/05/30 07:44:50
@@ -117,6 +117,8 @@
case "$lstate" in
query)
+ # --dump requires on of -{l,c,d}
+ # --triggers requires --script
_arguments -s \
-q "${commonopts[@]}" "${packageopts[@]}" "${pathopts[@]}" \
'--queryformat:RPM query format:->tags' \
@@ -126,11 +128,11 @@
'-s[show file states]' \
'-d[documentation files only]' \
'-c[configuration files only]' \
- '--dump[show all information]' # Requires one of -{l,c,d} ... \
+ '--dump[show all information]' \
--provides \
-{R,-requires}'[list dependencies]' \
'--scripts[show (un)install scripts]' \
- '--triggers[show trigger scripts]' # Requires --scripts ... \
+ '--triggers[show trigger scripts]' \
'*:RPM package:->package_or_file' && ret=0
;;
setattrs)
@@ -195,14 +197,14 @@
;;
target)
_wanted target expl 'Target platforms' \
- compadd $(_call target rpm --showrc |grep 'compatible archs'|sed 's/.*: //') && ret=0
+ compadd $(_call target rpm --showrc 2> /dev/null |grep 'compatible archs'|sed 's/.*: //') && ret=0
;;
package_or_file)
state=package_file
;&
package)
_wanted packages expl 'RPM package' \
- compadd -M 'r:|-=* r:|=*' - $(_call packages rpm -qa) && ret=0
+ compadd -M 'r:|-=* r:|=*' - $(_call packages rpm -qa 2> /dev/null) && ret=0
;;
spec_file)
_wanted specfiles expl 'spec file' \
@@ -224,7 +226,7 @@
if compset -P '*%*\{'; then
_wanted tags expl 'RPM tag' \
compadd -M 'm:{a-z}={A-Z}' -S '\}' - \
- "${(@)${(@f)$(_call tags rpm --querytags)}#RPMTAG_}" && ret=0
+ "${(@)${(@f)$(_call tags rpm --querytags 2> /dev/null)}#RPMTAG_}" && ret=0
else
_message 'RPM format'
fi
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.24
diff -u -r1.24 computil.c
--- Src/Zle/computil.c 2000/05/29 08:00:47 1.24
+++ Src/Zle/computil.c 2000/05/30 07:44:51
@@ -1437,7 +1437,7 @@
state.def->type == CAA_RARGS)) {
state.inrest = 0;
state.opt = (cur == state.nargbeg + 1 &&
- (!*line ||
+ (!multi || !*line ||
((*line == '-' || *line == '+') &&
(!line[1] ||
(*line == '-' && line[1] == '-' && !line[2])))));
@@ -1516,7 +1516,7 @@
}
} else {
ca_laststate.def = adef;
- ca_laststate.opt = (!arglast || !*line ||
+ ca_laststate.opt = (!arglast || !multi || !*line ||
((*line == '-' || *line == '+') &&
(!line[1] ||
(*line == '-' && line[1] == '-' && !line[2]))));
Index: Test/53completion.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/53completion.ztst,v
retrieving revision 1.4
diff -u -r1.4 53completion.ztst
--- Test/53completion.ztst 2000/05/17 12:31:32 1.4
+++ Test/53completion.ztst 2000/05/30 07:44:51
@@ -129,8 +129,7 @@
comptesteval 'compdef _tst tst; _tst () { _arguments "-x" ":arg:" }'
comptest $'tst -\t'
0:_arguments
->line: {tst -}{}
->MESSAGE:{arg}
+>line: {tst -x }{}
comptesteval 'compdef _tst tst; _tst () { _arguments "-x:arg:" }'
comptest $'tst -x\t'
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author