zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "zsh-users@sunsite.dk" <zsh-users@sunsite.dk>
Subject: Re: Problem with _arguments
Date: Wed, 22 Nov 2006 10:39:51 +0000	[thread overview]
Message-ID: <200611221039.kAMAdpal021905@news01.csr.com> (raw)
In-Reply-To: <dbfc82860611220035q30cc7278o87867885d82da92c@mail.gmail.com>

"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@csr.com>                  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


  reply	other threads:[~2006-11-22 10:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <now@bitwi.se>
2006-08-10 20:17 ` Completing a unique prefix of "script" completes "script" Nikolai Weibull
2006-08-10 21:41   ` Peter Stephenson
2006-08-13 14:49     ` Nikolai Weibull
2006-08-14 12:12       ` Peter Stephenson
2006-08-14 22:36         ` Nikolai Weibull
2006-08-13 14:59     ` Nikolai Weibull
2006-08-13 16:34       ` Peter Stephenson
2006-08-13 17:01         ` Nikolai Weibull
2006-11-21 22:57 ` Problem with _arguments Nikolai Weibull
2006-11-21 23:42   ` Peter Stephenson
2006-11-22  8:35     ` Nikolai Weibull
2006-11-22 10:39       ` Peter Stephenson [this message]
2006-11-22 15:55         ` Bart Schaefer
2006-11-22 22:22           ` Nikolai Weibull
2006-11-24 20:56             ` Bart Schaefer
2006-11-22 21:31         ` Nikolai Weibull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200611221039.kAMAdpal021905@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).