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

Re: Problem with _arguments



"Nikolai Weibull" wrote:
> > > _arguments \
> > >   '-s[omething]:with an argument' \
> > >   '*:directory:_directories'
> > >
> > > % craptastic src -s <Tab>
> > > ::: with an argument :::
> > > ::: directory :::
> 
> But it still offers the completion for -s, so it must have /some/ sort
> of understanding of what's going on already.

Right, my answer was a bit dozy... it looks like it's hedging, i.e. it's
completing as if the strict POSIX and GNU forms are both allowed and
it can't tell which applies.

> Actually, would there be a good way of tricking _arguments into only
> seeing what you want it to see?  In this case, it would work fine if
> one could trick it into only seeing the stuff after src, so that it
> would continue completing options.

There are certainly ways of updating the line, but the trouble is to
find out what you need to do either you're going to be doing some
parsing yourself or running _arguments twice.  You can edit words (the
command line) and CURRENT (the index into it), plus it's also possible
in some contexts to tell _arguments to limit the words visible in the
completion that it's calling by the use of enough colons.  I find
directly manipulating words and CURRENT less infuriating.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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