Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Q about _arguments



Andrej Borsenkow wrote:

> In some cases description string for option values is not used. Example
> is (part of fetchmail completion - I'll send as soon it is complete -
> with trivial "_arguments ..." form):
> 
> "(-m)--mda=[set MDA to use for forwarding]::mail delivery
> program:_command_names -e" \
> 
> and
> 
> bor@itsrm2% fetchmail --md=/to/b/p<TAB>
> 
> results in
> 
> bor@itsrm2% fetchmail --mda=/tools/bin/p
> Completing executable file or directory
> 
> ...
> 
> note, that I'd expect "Completing mail delivery program" here.

Hrm. That's because _command_names uses `_alternative -O' to give the
options it got to _alternative and that puts them at the beginning,
but then _all_labels puts the $expl[@] it builds even before that.

Bye
 Sven

Index: Completion/Base/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.3
diff -u -r1.3 _arguments
--- Completion/Base/_arguments	2000/04/05 12:06:31	1.3
+++ Completion/Base/_arguments	2000/04/07 12:39:30
@@ -258,8 +258,9 @@
             # Otherwise we call it with the description-arguments.
 
             eval "action=( $action )"
-            _all_labels arguments expl "$descr" \
-                "$action[1]" "$subopts[@]" "${(@)action[2,-1]}"
+            while _next_label arguments expl "$descr"; do
+              "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
+	    done
           fi
         fi
       fi
Index: Completion/Base/_values
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_values,v
retrieving revision 1.2
diff -u -r1.2 _values
--- Completion/Base/_values	2000/04/01 20:43:43	1.2
+++ Completion/Base/_values	2000/04/07 12:39:30
@@ -141,8 +141,9 @@
       # Otherwise we call it with the description-arguments built above.
 
       eval "action=( $action )"
-      _all_labels arguments expl "$descr" \
-          "$action[1]" "$subopts[@]" "${(@)action[2,-1]}"
+      while _next_label arguments expl "$descr"; do
+        "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
+      done
     fi
   fi
 
Index: Completion/Core/_alternative
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_alternative,v
retrieving revision 1.2
diff -u -r1.2 _alternative
--- Completion/Core/_alternative	2000/04/01 20:43:43	1.2
+++ Completion/Core/_alternative	2000/04/07 12:39:30
@@ -66,8 +66,9 @@
         # Otherwise we call it with the description-arguments built above.
 
         eval "action=( $action )"
-        _all_labels "${def%%:*}" expl "$descr" \
-            "$action[1]" "$subopts[@]" "${(@)action[2,-1]}"
+	while _next_label "${def%%:*}" expl "$descr"; do
+          "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
+        done
       fi
     fi
   done

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author