Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Doc/Zsh/compsys.yo: clarify _alternative's action syntax
- X-seq: zsh-workers 49575
- From: Arseny Maslennikov <ar@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Cc: Arseny Maslennikov <ar@xxxxxxxxx>
- Subject: [PATCH] Doc/Zsh/compsys.yo: clarify _alternative's action syntax
- Date: Sat, 13 Nov 2021 00:19:54 +0300
- Archived-at: <https://zsh.org/workers/49575>
- In-reply-to: <25893-1636747789.372237@C2gS.agl2.N2lP>
- List-id: <zsh-workers.zsh.org>
- References: <25893-1636747789.372237@C2gS.agl2.N2lP>
---
Recently, while writing a completion function that uses _alternative to
generate several groups of matches and description strings with
_describe, I decided to look closely at _alternative's source.
It turned out that, contrary to the documentation, I do not have to
escape the separator between a match and its description in the embedded
array representation, unlike the analogous form for an _arguments spec
action.
Doc/Zsh/compsys.yo | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 89b918d60..b37a752be 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -3616,8 +3616,18 @@ described using the var(spec)s which are of the form:
`var(tag)tt(:)var(descr)tt(:)var(action)'. The var(tag)s are offered using
tt(_tags) and if the tag is requested, the var(action) is executed with the
given description var(descr). The var(action)s are those accepted
-by the tt(_arguments) function (described below), excluding the
-`tt(->)var(state)' and `tt(=)var(...)' forms.
+by the tt(_arguments) function (described below), with the following
+exceptions:
+startitemize()
+itemiz(\
+The `tt(->)var(state)' and `tt(=)var(...)' forms are not supported.
+)
+itemiz(\
+The `tt(LPAR()LPAR()a\:bar b\:baz)tt(RPAR()RPAR())' form does not need
+the colon to be escaped, since the var(spec)s have no colon-separated fields
+after the var(action).
+)
+enditemize()
For example, the var(action) may be a simple function call:
--
2.33.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author