Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completing possible elements of a comma-separated list
- X-seq: zsh-users 6604
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Malte Starostik <malte.starostik@xxxxxxxxxxx>
- Subject: Re: Completing possible elements of a comma-separated list
- Date: Fri, 19 Sep 2003 15:03:18 +0200
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <200309181908.01862.malte.starostik@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200309181908.01862.malte.starostik@xxxxxxxxxxx>
Malte Starostik wrote:
>
> I'm trying to write a completion for slptool. One of its commands is
> slptool findattrs <service> [attr ids]
> Now I'd like to continue completion with the same list of possible matches,
> completing any id in the comma separated list independently of each other
> against the list of available ids.
Easiest way is probably to use:
_values -s , 'attribute id' $(slptool findattrs ...)
Otherwise, you can use:
local -a suf
compset -P '*,'
compset -S ',*' || suf=( -S , )
compadd ... "$suf[@]" ...
That'll make it ignore anything before the cursor up the last comma
(and the same in reverse for after the cursor).
> Also, would be nice if
> slptool findattrs example.acme u,p<TAB>
> could complete to
> slptool findattrs example.acme username,password,
> as well.
That's harder. _sep_parts or _multi_parts might help you. Otherwise, you
need to start using compadd -O and it gets complicated.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author