Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Saving the zle display stuff



Sven Wischnowsky wrote:
> > > > Is there a better way for me to have done the equivalent of :*:nothing:_nothing for the -r option?
> > >
> > > Can't think of a better way... never thought about that. Hm. Is it
> > > worth to make _arguments support this directly, i.e. add a syntax
> > > saying: `no more arguments after this option'?
> >
> > There's probably quite a lot of commands like zpty where they can be
> > used in a few separate ways (each with their own set of arguments) and
> > for these commands it is useful to avoid the final arguments for some
> > forms so if it is fairly simple to do and there is a clear way of
> > representing it in the _arguments parameters then it is probably worth
> > doing.
> 
> Any suggestions for the syntax? (A trailing colon with no description
> after it?)

That would be fine.

An alternative which might be worth thinking about is to allow all lines
in _arguments to specify a list of options with which they are mutually
exclusive. So in the vase of _zpty, I would use:
  '(-r)*::args:_normal'
as the last line.

I think this might be more useful. For example consider the case of
AIX's lsvg command for which I recently wrote a completion function.
It's syntax is of the following form:

Usage: lsvg [-o] [-n PVname]
       lsvg [-i] [-M|-l|-p] VGname...

So basically it has two different forms. The trouble is that I can't use
my _nothing trick for -o or -n because I might want to complete a -n
option after a -o option or vice-versa. It worked for zpty's -r option
because -r can only be used on its own. What I would like to do for lsvg
is to use something like:
  '(-o -n)*:volume groups:_volume_groups'
for the last line.

I seem to have some fairly long option exclusion lists in some of my
completions so it might also be worth thinking if there are any better
ways of doing the completion when there are separate forms of the
command. I experimented with a few things like using two calls to
_arguments without much success.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author