zsh-users
 help / color / mirror / code / Atom feed
From: Scott Frazer <frazer.scott@gmail.com>
To: zsh-users@zsh.org
Subject: Re: Complete value from list with colons
Date: Mon, 26 Aug 2019 09:34:28 -0400	[thread overview]
Message-ID: <qk0n55$24dn$1@blaine.gmane.org> (raw)
In-Reply-To: <43968-1566695897.640296@MmkN.TxK5.ExqF>

On 8/24/2019 9:18 PM, Oliver Kiddle wrote:
> "Daniel Shahaf" wrote:
>> Scott Frazer wrote on Sat, 24 Aug 2019 12:44 +00:00:
>>> I would like to do completion from a list of values that have ':' in
>>> them, something like:
>>>
>>> _values foo a::b c::d
> 
>> Backslashes:
>>
>> % _f() { _values desc 'foo\:\:FOO' 'bar\:\:BAR' }
> 
> Or don't use _values:
> 
>    _wanted foos expl foo compadd a::b c::d
> 
> Which particular feature of _values do you want? For lists, you can use
> _sequence, e.g.:
>    _wanted foos expl foo _sequence compadd - a::b c::d
> 
> and if you want descriptions, _describe might do the job but probably
> still needs colons to be quoted. _values is usually not the best choice
> when the list of matches are generated somehow.
> 
> Oliver
> 

I guess I don't know which is most appropriate, there are many options 
and _values seemed to fit the bill.

I pared things down for my question, but to be more exact I want 
completion for an option.  Something like:

_arguments : '--foo[Which foo to use]:foo:_values whatever 'a\:\:b' 'c\:\:d'

i.e. the --foo option has a limited number of legal values.  What would 
you suggest I use here?

Scott


  reply	other threads:[~2019-08-26 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-24 12:43 Scott Frazer
2019-08-24 17:26 ` Daniel Shahaf
2019-08-25  1:18   ` Oliver Kiddle
2019-08-26 13:34     ` Scott Frazer [this message]
2019-08-26 17:39       ` dana
2019-08-26 13:28   ` Scott Frazer

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='qk0n55$24dn$1@blaine.gmane.org' \
    --to=frazer.scott@gmail.com \
    --cc=zsh-users@zsh.org \
    /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).