help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Pavol Juhas <pavol.juhas@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: bug-or-feature - different completion context after "--option VALUE" vs "--option=VALUE"
Date: Thu, 21 Jul 2022 15:34:25 -0700	[thread overview]
Message-ID: <CAH+w=7YZmrDd04m-K_s8d=zTCeG=Pyk1P2bf6X9nHjbo0Uqnng@mail.gmail.com> (raw)
In-Reply-To: <CAA44gkXbxotDR2CaEoEOciheuEN487c_JrdFipG1uixEWt-_7w@mail.gmail.com>

On Wed, Jul 20, 2022 at 9:19 PM Pavol Juhas <pavol.juhas@gmail.com> wrote:
> _arguments : \
>     - name \
>     '--name=[name of a person]:person-name:()' \
>     '1:letters:(a b c)' \
>     - without-name \
>     '*:digits:(1 2 3)' \
>     ;

The "sets of arguments" notation has always been a bit tricky.  Oliver
may have some insight here.  I think the problem is that because the
without-name set has ONLY a catch-all, it is always the preferred
context, that is, when parsing the command line to see which set is
present, the without-name set is always chosen.  The sets aren't
necessarily matched and made mutually exclusive in the order they

I would suggest instead that you use the explicit exclusion notation:

_arguments : \
  '(*)--name=[name of a person]:person-name' \
  '1:letters:(a b c)' \
  '*:digits:(1 2 3)'

Something interesting is going on when you append ':()' to the --name
spec, and I don't know if that's intentional on your part.  What that
says, if I read things correctly, is that the mandatory argument to
--name can be the empty string, which effectively makes it an optional
argument, so there are some puzzling side-effects.  I've dropped ':()'
from my example to avoid that.

      reply	other threads:[~2022-07-21 22:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21  4:18 Pavol Juhas
2022-07-21 22:34 ` Bart Schaefer [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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7YZmrDd04m-K_s8d=zTCeG=Pyk1P2bf6X9nHjbo0Uqnng@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=pavol.juhas@gmail.com \
    --cc=zsh-workers@zsh.org \


* 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


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).