Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with _arguments
- X-seq: zsh-users 11014
- From: "Nikolai Weibull" <now@xxxxxxxx>
- To: "Peter Stephenson" <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: Problem with _arguments
- Date: Wed, 22 Nov 2006 09:35:37 +0100
- Cc: "zsh-users@xxxxxxxxxx" <zsh-users@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=KFk69/9NGZa35XHKFwhVz0TXGO278w+LCGlJysbx7FZTA/sIU4F4bQYl1gKJzOtDhqMWE3q4ZZUO4tL3sp+pr4VPILQ2oyCZfCySikbLHYC+ZMrAdiGM7ygknx1A/6lPDSj+ln534PFYkD0UXtayRQ4N0qoKB+5OnyVN02lxCO0=
- In-reply-to: <200611212342.kALNg9m7006648@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <now@xxxxxxxx> <dbfc82860611211457s3a6054d0t947d8054f553e312@xxxxxxxxxxxxxx> <200611212342.kALNg9m7006648@xxxxxxxxxxxxxxxxx>
- Sender: nikolai.weibull@xxxxxxxxx
On 11/22/06, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
"Nikolai Weibull" wrote:
> Say that I have
>
> #compdef craptastic
>
> _arguments \
> '-s[omething]:with an argument' \
> '*:directory:_directories'
>
> Then, at least with my setup, if I have the following command line and
> press <Tab> I get:
>
> % craptastic -s <Tab>
> ::: with an argument :::
>
> but if I have the following and press <Tab> I get:
>
> % craptastic src -s <Tab>
> ::: with an argument :::
> ::: directory :::
>
> Why is directory all of a sudden a viable option here?
_arguments [ -nswWACRS ] [ -O name ] [ -M matchspec ] [ : ] spec ...
This function can be used to give a complete specification for
completion for a command whose arguments follow standard UNIX
option and argument conventions.
"Standard UNIX option and argument conventions" are that all options
come before all non-option arguments. The GNU extension that they can
occur in any order is not supported. So -s is an argument following the
argument src. _arguments thinks src, -s and the argument you're now
completing are normal arguments and hence completes directories.
But it still offers the completion for -s, so it must have /some/ sort
of understanding of what's going on already.
Oh well, I guess I'll have to give up on this for the time being.
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.
Thanks.
nikolai
Messages sorted by:
Reverse Date,
Date,
Thread,
Author