Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
completion: _normal after argument
- X-seq: zsh-users 18993
- From: Martin Vaeth <martin@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: completion: _normal after argument
- Date: Mon, 28 Jul 2014 12:16:10 +0000 (UTC)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Reply-to: martin@xxxxxxxx
Hi,
for some scripts I am currently writing some completion functions.
The syntax of the call should be
foo [lots of complicated options] CMD [shell-command with options]
Naturally, since the options can be treated with _arguments in
a standard way, I want to use something like
_arguments -C -s -S -A '-*' : \
--optA=.... \
--optB... \
-q... \
...
'1:command:->cmds' \
'*::command:->normal'
It is clear to me what to do in case $state == cmds
But what to do in case $state == normal?
Essentially, I want to call of course _normal
(after cutting the "options+CMD" part from the words array and
decreasing the CURRENT parameter correspondingly).
But how to find where the "options+CMD" part has finished?
Is it really necessary to "manually" parse all the options again
(checking what is argument etc, that is, essentially to re-programm
manually what should already have been done by _arguments)
or is there another possibility?
In case the above description is unclear:
Here is a link to the [yet unsatisfactory] completion file
https://github.com/vaeth/schedule/blob/master/zsh/_schedule
(Currently, I always remove everything up to CURRENT, but this is
"correct" only for the first argument after CMD, of course)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author