Zsh Mailing List Archive
Messages sorted by:
Re: Completing on options in name=value format?
- X-seq: zsh-users 5907
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Bill Burton <billb@xxxxxxxxxxxx>
- Subject: Re: Completing on options in name=value format?
- Date: Tue, 11 Feb 2003 09:11:28 +0100
- Cc: Zsh Users List <zsh-users@xxxxxxxxxx>
- In-reply-to: <3E3EF1BF.8040403@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <3E3EF1BF.8040403@xxxxxxxxxxxx>
- Sender: kiddleo@xxxxxxxxxx
On 3 Feb, Bill Burton wrote:
> I'm writing a completion function for some home grown scripts that
> require options in the format name=value. I'm having two problems with
> my function:
> The command is as follows with the area and pf options required but the
> test option is not:
> startws area=<a subdirecties under /usr/local> \
> pf=<a file with a .pf suffix relative to
> the directory completed in the area option>
> In order to complete the pf option, the area option must be specified first.
> The function mostly works but I still have the following issues:
> 1. After I complete on the area= option, it still shows up on the
> completion menu.
In zsh 4.1 there is a -w option to _values that will fix this. _values
isn't as good as I'd like. The issues were discussed in depth in
relation to _dd if you want to search the archives for it.
> 2. The .pf suffix for the filename on the pf option isn't stripped off.
I think you've misunderstood what -s to compadd does. -W and -g are
options to _files and not compadd.
How you should write it depends on whether you want to complete
subdirectories along with .pf files. If not,
should do it.
> 3. After completing an option and its argument, there's an extranious
> "=" appended to the end:
That's what you told it to do in the line:
compadd -qS = -a area_dirs
At least in 4.1, your -s = argument to _values is redundant. -S specifies
the separator between values and their arguments (default =) while -s
specifies the value separator.
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Messages sorted by: