zsh-users
 help / color / mirror / code / Atom feed
* completion: _normal after argument
@ 2014-07-28 12:16 Martin Vaeth
  2014-07-28 20:12 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Vaeth @ 2014-07-28 12:16 UTC (permalink / raw)
  To: zsh-users

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)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-29  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 12:16 completion: _normal after argument Martin Vaeth
2014-07-28 20:12 ` Peter Stephenson
2014-07-29  2:54   ` Bart Schaefer
2014-07-29  7:37   ` Oliver Kiddle
2014-07-29  8:50   ` Martin Vaeth

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).