From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: The options variable of _arguments.
Date: Tue, 14 Sep 1999 10:17:47 +0200 (MET DST) [thread overview]
Message-ID: <199909140817.KAA26718@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 14 Sep 1999 05:32:47 +0900
Tanaka Akira wrote:
> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% _tst () { _arguments -s '-a' '-b' ':descr:{ compadd - $+options[-a] }' }
> is27e1u11% tst -ab <TAB>
>
> ->
>
> is27e1u11% tst -ab 0
>
> Hm. It should be:
>
> is27e1u11% tst -ab 1
Right. For single-character options the `options' assoc wasn't
correctly set.
This also documents that `expl' may be use inside actions.
Bye
Sven
diff -u oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments Tue Sep 14 09:09:00 1999
+++ Completion/Base/_arguments Tue Sep 14 10:16:27 1999
@@ -8,7 +8,7 @@
local args rest ws cur nth def nm expl descr action opt arg tmp xor
local single uns ret=1 aret soptseq soptseq1 sopts prefix _line odescr
local beg optbeg argbeg nargbeg inopt inrest fromrest cmd="$words[1]"
-local matched curopt noargs
+local matched curopt noargs i
# Associative arrays used to collect information about the options.
@@ -433,7 +433,9 @@
if (( $+opts[$tmp] )); then
def="$opts[$tmp]"
curopt="$tmp"
- _options[$curopt]=''
+ for i in ${(s::)ws[1][2,-1]}; do
+ _options[${ws[1][1]}$i]=''
+ done
optbeg="$beg"
argbeg="$beg"
inopt=yes
@@ -646,6 +648,9 @@
def="$dopts[$tmp[1]]"
opt=''
uns="${prefix[2,-1]%%${tmp[1][2]}*}${tmp[1][2]}"
+ for i in ${(s::)prefix[2,-1]%%${tmp[1][2]}*} ${tmp[1][2]}; do
+ _options[${prefix[1]}$i]=''
+ done
break
elif compset -P "$tmp[1]"; then
@@ -667,6 +672,9 @@
def="$odopts[$tmp[1]]"
opt=''
uns="${prefix[2,-1]%%${tmp[1][2]}*}${tmp[1][2]}"
+ for i in ${(s::)prefix[2,-1]%%${tmp[1][2]}*} ${tmp[1][2]}; do
+ _options[${prefix[1]}$i]=''
+ done
break
elif compset -P "$tmp[1]"; then
def="$odopts[$tmp[1]]"
diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- od/Zsh/compsys.yo Tue Sep 14 09:08:51 1999
+++ Doc/Zsh/compsys.yo Tue Sep 14 10:12:51 1999
@@ -819,7 +819,10 @@
otherwise it will be invoked with some extra string placed after the
first word which can be given as arguments to the tt(compadd) and
tt(compgen) builtins and which make sure that the var(message) given
-in the description will be shown above the matches.
+in the description will be shown above the matches. These arguments
+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[@])').
In places where no sensible matches can be generated, the action
should consist of only a space. This will make the var(message) be
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-09-14 8:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-14 8:17 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-09-13 20:32 Tanaka Akira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199909140817.KAA26718@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).