Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_arguments questions
- X-seq: zsh-workers 10457
- From: Alexandre Duret-Lutz <duret_g@xxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: _arguments questions
- Date: 04 Apr 2000 12:24:31 +0200
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Hi.
I have some troubles with nested `_arguments'...
_foo () {
_arguments -c -d -e
}
_test () {
_arguments -a -b '-c:*::blah: _foo'
}
The wanted behaviour is that any arguments given after the first `-c' shall
complete to `-c', `-d', or `-e'. Unfortunately:
phobos% compdef _test test
phobos% test -c -<TAB>
-a -b
Strange. Tracing trough the code, I found that the call to `_arguments' in
`_foo' returned 1 because `compargument -i' ensures that CURRENT > 1.
Indeed, if I add a dummy option after the first `-c' it completes right :
phobos% test -c -dummy -<TAB>
-c -d -e
Then, I can try to add this dummy word automatically :
_bar () {
words=(dummy $words)
(( ++CURRENT ))
_foo
}
_test () {
_arguments -a -b '-c:*::blah: _bar'
}
But the behaviour is now
phobos% test -c -<TAB>
-a -b -c -d -e
with unwanted `-a' and `-b'. And after the first option I get
phobos% test -c -d -<TAB>
-c -e
which is correct.
So questions are
1) is there a simplier way to nest `_arguments' ?
2) how to suppress those unwanted `-a' and `-b' ?
--
Alexandre Duret-Lutz
Messages sorted by:
Reverse Date,
Date,
Thread,
Author