zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Bill Burton <billb@progress.com>
Cc: Zsh Users List <zsh-users@sunsite.dk>
Subject: Re: Completing on options in name=value format?
Date: Tue, 11 Feb 2003 09:11:28 +0100	[thread overview]
Message-ID: <7850.1044951088@finches.logica.co.uk> (raw)
In-Reply-To: <3E3EF1BF.8040403@progress.com>

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>
>            test={yes|no}
> 
> 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,
  compadd ${BASEDIR:-/usr/local}/${area}/conf/*.pf(:r:t)
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.

Oliver

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.


      reply	other threads:[~2003-02-11  8:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-03 22:48 Bill Burton
2003-02-11  8:11 ` Oliver Kiddle [this message]

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=7850.1044951088@finches.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=billb@progress.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).