From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: _arguments optspecs (was Re: Editing the history in the shell)
Date: Sun, 24 May 2020 15:02:43 -0700 [thread overview]
Message-ID: <CAH+w=7ZxOQQCwzCzYm6NX1NP-HPspACV_Yf56b0O3VZP=jsfPA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7aWxdY3KuTaYym1GiAowRRHBc=2AJPPgqOmN8G6L0xT2A@mail.gmail.com>
On Sat, May 23, 2020 at 2:30 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> I'm not entirely sure about some
> of the _zed optspecs, but all the desired combinations seem to work
> and all the undesired ones seem not to.
My uncertainty is around these three lines:
> '(- 2):file:_files' \
> + '(-f -x 1)-h[edit history]:history file:_files' \
> + '2:history size: ';;
The first spec causes "file" to be offered (as the first non-option
argument) if there is no option yet, and will not offer a second
argument.
The second spec offers -h followed by "history file" as the argument
to -h, and won't offer -f or -x or a first non-option argument.
The third spec expects "history size" as the second non-option
argument, but does not provide any completions.
What's strange is why "history size" is the second non-option
argument. If I leave (1) out of the exclusion list on the second
spec, I get offered "file", so in that case the argument to -h is
being taken as an option argument; but after filling in that position
I next get "no more arguments" instead of "history files". So it
appears that sometimes the argument of -h is not counted as a
non-option argument, and other times it is so counted, which is why
it's "2:" in the third optspec and the (1) is required in the second
optspec.
Does anybody actually understand this? Is it explainable (or already
explained, where?) in the doc for _arguments?
next prev parent reply other threads:[~2020-05-24 22:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 22:24 Editing the history in the shell Bart Schaefer
2020-05-23 2:28 ` Daniel Shahaf
2020-05-23 21:30 ` Bart Schaefer
2020-05-24 22:02 ` Bart Schaefer [this message]
2020-05-25 17:29 ` _arguments optspecs (was Re: Editing the history in the shell) Oliver Kiddle
2020-05-25 22:32 ` Bart Schaefer
2020-05-26 7:56 ` Oliver Kiddle
2020-05-25 22:42 ` Bart Schaefer
[not found] ` <20200525023515.7855610a@tarpaulin.shahaf.local2>
[not found] ` <CAH+w=7bTCCC2XBr+_HCAPqXWuOV_YOrDv+36C6jJScKrxZjhLQ@mail.gmail.com>
2020-05-27 3:32 ` Fwd: Editing the history in the shell Bart Schaefer
2021-04-25 21:56 ` [PATCH] " Bart Schaefer
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='CAH+w=7ZxOQQCwzCzYm6NX1NP-HPspACV_Yf56b0O3VZP=jsfPA@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--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).