Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_arguments optspecs (was Re: Editing the history in the shell)
- X-seq: zsh-workers 45909
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: _arguments optspecs (was Re: Editing the history in the shell)
- Date: Sun, 24 May 2020 15:02:43 -0700
- In-reply-to: <CAH+w=7aWxdY3KuTaYym1GiAowRRHBc=2AJPPgqOmN8G6L0xT2A@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAH+w=7ZFt7jshjv1FCEbmP_PgADvdKwymRutrzwJAvzNpsfOmA@mail.gmail.com> <20200523022807.08f3ba45@tarpaulin.shahaf.local2> <CAH+w=7aWxdY3KuTaYym1GiAowRRHBc=2AJPPgqOmN8G6L0xT2A@mail.gmail.com>
On Sat, May 23, 2020 at 2:30 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author