* completion after --
@ 2003-07-26 16:57 Erik Toubro Nielsen
2003-08-01 11:36 ` Oliver Kiddle
0 siblings, 1 reply; 2+ messages in thread
From: Erik Toubro Nielsen @ 2003-07-26 16:57 UTC (permalink / raw)
To: zsh-users
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.
Any hints on how to write a completion function _cmd for this?
Erik
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: completion after --
2003-07-26 16:57 completion after -- Erik Toubro Nielsen
@ 2003-08-01 11:36 ` Oliver Kiddle
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2003-08-01 11:36 UTC (permalink / raw)
To: Erik Toubro Nielsen; +Cc: zsh-users
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
________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-01 15:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-26 16:57 completion after -- Erik Toubro Nielsen
2003-08-01 11:36 ` Oliver Kiddle
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).