zsh-workers
 help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] Completion: Add _log_priorities, _logger
Date: Sat, 02 Nov 2019 07:45:27 +0000	[thread overview]
Message-ID: <6dd17886-7097-4f7f-b254-f17ef861abf4@www.fastmail.com> (raw)
In-Reply-To: <95142696-7C02-4969-8F55-719FEAF646D8@dana.is>

dana wrote on Sat, 02 Nov 2019 06:58 +00:00:
> On 2 Nov 2019, at 01:45, dana <dana@dana.is> wrote:
> > That would definitely work, and be easy to parse, though it is a bit
> > unattractive, especially given how these functions are often called.
> 
> Oh, i realised with your *very* first suggestion, the quoting wouldn't be
> quite as bad:
> 
>   '--foo=[specify foo]: :_my_type -Y-a -Y"my optarg" -Y-bcd'
> 
> Though it's certainly strange in a different way.

Strange how?  I think it's pretty intuitive: to call «_foo "$bar[@]"»,
write «_foo -Y"${^bar[@]}"» (?).  This is:

- Completely generic: it doesn't depend on the value of «"${bar[@]}"»,
  whether it uses single-letter options or GNU-style long options or
  anything else.

- Composable: it's trivial to pass -bcd through _two_ layers of these
  wrappers, should that ever be necessary.  (Example: pdebuild(1) calls
  dpkg-buildpackage(1) which in turn calls dpkg-genbuildinfo(1), and
  it's possible to pass dpkg-genbuildinfo(1) arguments to pdebuild(1).)

- Requires no new code to implement.  It's simply a repeatable option
  whose optargs are collected in an array.  Both zparseopts and _arguments
  already support this.

> It would be cool if there was a convenient way to just have a general prefix
> for options, so that this kind of thing would work:
> 
>   '--foo=[specify foo]: :_my_type -Ya "my optarg" -Ybcd'
> 
> (The point being that (a) you don't have to repeat the hyphens and (b) it
> knows that "my optarg" is an argument to the type function's -a.)
> 
> Maybe zparseopts could be extended to do that somehow, if it's not too silly
> of an idea.

*nod*

Cheers,

Daniel

  reply	other threads:[~2019-11-02  7:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02  2:14 dana
2019-11-02  5:54 ` Daniel Shahaf
2019-11-02  6:45   ` dana
2019-11-02  6:58     ` dana
2019-11-02  7:45       ` Daniel Shahaf [this message]
2019-11-02  8:20         ` dana

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=6dd17886-7097-4f7f-b254-f17ef861abf4@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@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).