Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion after --
- X-seq: zsh-users 6426
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Erik Toubro Nielsen <erik@xxxxxxxxxxxxxxxx>
- Subject: Re: completion after --
- Date: Fri, 01 Aug 2003 13:36:58 +0200
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <m2k7a59qfb.fsf@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <m2k7a59qfb.fsf@xxxxxxxxxxxxxxxx>
On 26 Jul, Erik Toubro Nielsen wrote:
> Assume a command line, where the option --files mean that at least one
> filename can be given after '--'
>
> cmd --files --other-options ARG1 -- filenames...
>
> (without --files the command line is
> cmd --other-options ARG1
> )
>
> The _arguments function does not seem applicable.
_arguments is applicable but it isn't sufficient on it's own.
> Any hints on how to write a completion function _cmd for this?
Check for --files and -- before calling _arguments:
local -a args
if (( ${+words[(r)--files]} && ${+words[(r)--]} && words[(i)--] < CURRENT ))
then
_wanted files expl file _files
else
_arguments '--files' '--other-options' ':arg1:(ARG1)'
fi
That also checks that the `--' is before the cursor.
Oliver
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________
Messages sorted by:
Reverse Date,
Date,
Thread,
Author