about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-30 07:49:00 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-30 07:49:00 +0000
commit47c0bd0db1e9f9788f3ddb225b9ae2a17775e4c6 (patch)
tree64bdfe68ea2846a1e07d6e2e92662de8685033c1
parent61a2d24f54e177d952fb2a8f7a6e446f5cdd13cb (diff)
downloadzsh-47c0bd0db1e9f9788f3ddb225b9ae2a17775e4c6.tar.gz
zsh-47c0bd0db1e9f9788f3ddb225b9ae2a17775e4c6.tar.xz
zsh-47c0bd0db1e9f9788f3ddb225b9ae2a17775e4c6.zip
fixes for _arguments without multiple sets; change completion test for empty actions (11647)
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Base/_arguments1
-rw-r--r--Completion/Linux/_rpm12
-rw-r--r--Src/Zle/computil.c4
-rw-r--r--Test/53completion.ztst3
5 files changed, 17 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index e461b3c2c..d860cfd49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-05-30  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 11647: Completion/Base/_arguments, Completion/Linux/_rpm,
+ 	Src/Zle/computil.c, Test/53completion.ztst: fixes for _arguments
+ 	without multiple sets; change completion test for empty actions
+	
 2000-05-29  Bart Schaefer  <schaefer@zsh.org>
 
 	* 11644: Use `print -s' in _complete_debug, now that it works.
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index 5581e5bd9..da7a7ad4a 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -319,6 +319,7 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
 	        compadd -QqS= - "${PREFIX}${SUFFIX}"
           else
 	    tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" )
+	    [[ "$PREFIX" != --* ]] && tmp1=( "${(@)tmp1:#--*}" )
 	    tmp3=( "${(M@)tmp1:#[-+]?[^:]*}" )
 	    tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
 	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
diff --git a/Completion/Linux/_rpm b/Completion/Linux/_rpm
index adcfa341b..ba18c8c17 100644
--- a/Completion/Linux/_rpm
+++ b/Completion/Linux/_rpm
@@ -117,6 +117,8 @@ while [[ -n "$state" ]]; do
 
   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 @@ while [[ -n "$state" ]]; do
       '-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 @@ while [[ -n "$state" ]]; do
     ;;
   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 @@ while [[ -n "$state" ]]; do
     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
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index d8b4f0cb6..1a98528df 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1437,7 +1437,7 @@ ca_parse_line(Cadef d, int multi, int first)
 		 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 @@ ca_parse_line(Cadef d, int multi, int first)
 		}
 	    } 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]))));
diff --git a/Test/53completion.ztst b/Test/53completion.ztst
index b548a9bf7..f79a99586 100644
--- a/Test/53completion.ztst
+++ b/Test/53completion.ztst
@@ -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'