Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with _arguments
- X-seq: zsh-users 11015
- From: Peter Stephenson <pws@xxxxxxx>
- To: "zsh-users@xxxxxxxxxx" <zsh-users@xxxxxxxxxx>
- Subject: Re: Problem with _arguments
- Date: Wed, 22 Nov 2006 10:39:51 +0000
- In-reply-to: <dbfc82860611220035q30cc7278o87867885d82da92c@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <now@xxxxxxxx> <dbfc82860611211457s3a6054d0t947d8054f553e312@xxxxxxxxxxxxxx> <200611212342.kALNg9m7006648@xxxxxxxxxxxxxxxxx> <dbfc82860611220035q30cc7278o87867885d82da92c@xxxxxxxxxxxxxx>
"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