about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-05 12:06:30 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-05 12:06:30 +0000
commit80ac43783a990ecb1e5234e3d7a682508102e42f (patch)
tree2ace88d6cbd969dd1f1d766b9802ad6844c7157c
parentb8bdb144d2a310632efb3bbd7dd78d4f296bc62f (diff)
downloadzsh-80ac43783a990ecb1e5234e3d7a682508102e42f.tar.gz
zsh-80ac43783a990ecb1e5234e3d7a682508102e42f.tar.xz
zsh-80ac43783a990ecb1e5234e3d7a682508102e42f.zip
support automatically inserted dummy in $words
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/_arguments6
-rw-r--r--Doc/Zsh/compsys.yo19
3 files changed, 27 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f38b5889..adcd2acf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
 
 2000-04-05  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
+	* 10514: Completion/Base/_arguments, Doc/Zsh/compsys.yo:
+	support automatically inserted dummy in $words
+
 	* 10511: Completion/Debian/_apt, Completion/Debian/_bug,
 	Completion/Debian/_dpkg, Completion/User/_chown,
 	Completion/User/_dvi, Completion/User/_imagemagick,
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index bf263d6e9..29e5764fe 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -192,6 +192,12 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
       if [[ -n "$matched" ]] || _requested arguments; then
         _description arguments expl "$descr"
 
+        if [[ "$action" = \=\ * ]]; then
+          action="$action[3,-1]"
+          words=( "$subc" "$words[@]" )
+	  (( CURRENT++ ))
+        fi
+
         if [[ "$action" = -\>* ]]; then
           comparguments -W line opt_args
           state="${${action[3,-1]##[ 	]#}%%[ 	]#}"
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 3cb9e4ff8..035a98e0d 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2497,7 +2497,7 @@ using the var(specs) which are of the form:
 using tt(_tags) and if the tag is requested, the var(action) is
 executed with the given var(descr) (description). The var(action)s
 supported are those used by the tt(_arguments) function (described
-below), without the `tt(->)var(state)' form.
+below), without the `tt(->)var(state)' and `tt(=)var(...)' forms.
 
 For example, the var(action) may be a simple function call. With that
 one could do:
@@ -2794,6 +2794,23 @@ are taken from the array parameter tt(expl) which will be set up
 before executing the var(action) and hence may be used in it (normally 
 in an expansion like `tt($expl[@])').
 
+If the var(action) starts with `tt(= )' (a equal sign followed by a
+space), tt(_arguments) will insert the contents of the var(argument)
+field of the current context as the new first element in the tt(words) 
+special array and increments the value of the tt(CURRENT) special
+parameter. In other words, it inserts a dummy element in the tt(words) 
+array and makes tt(CURRENT) still point to the word in that array
+where the cursor is. This is only really useful when used with one of
+the forms that make tt(_arguments) modify the tt(words) array to
+contain only some of the words from the line, i.e. one of the argument 
+description forms where the var(message) is preceded by two or three
+colons. For example, when the function called in the action for such
+an argument itself uses tt(_arguments), the dummy element is needed to 
+make that second call to tt(_arguments) use all words from the
+restricted range for argument parsing. Without the inserted dummy
+element, the first word in the range would be taken (by the second
+tt(_arguments)) to be the command name and hence ignored.
+
 Except for the `tt(->)var(string)' form, the var(action) will be
 executed by calling the tt(_all_labels) function to process all tag labels,
 so one doesn't need to call that explicitly unless another tag is to