From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] new completions for head and tail commands
Date: Wed, 28 Oct 2015 21:56:29 +0900 [thread overview]
Message-ID: <03DAC035-D571-4A2D-B60F-48C90AFDF2EC@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAH+w=7YOw0K=mntgwuAxxo3ovVpDnL9+_dPNHRGngRrex6_CBw@mail.gmail.com>
On 2015/10/28, at 5:54, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tue, Oct 27, 2015 at 1:34 PM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>> Jun T. wrote on Tue, Oct 27, 2015 at 22:44:47 +0900:
>>> + opts='-A "-*"'
>>> (snip)
>>> +_arguments -C -s -S $opts : $args '*:file:_files' && return 0
>>
>> Should that be ${=opts}?
>
> Or opts=(-A "-*") more likely.
Thanks.
I will commit/push with the fix opts=(-A "-*") (which I believe the
correct one). But there remains a behavior which I still don't understand.
Using opts=(-A "-*") is equivalent to
[1] _arguments -A '-*'
while ${=opts} may correspond to
[2] _arguments -A '"-*"'
i.e., the pattern includes double quotes. My original is equivalent to
[3] _arguments '-A "-*"'
which looks quite wrong but seems to (accidentally) work due to a strange
option parsing of _arguments (so I didn't notice the error while testing).
All of the above work in the sense that, on non-gnu systems,
% tail file1 -<TAB>
does not complete any options. But if there is a file whose name starts
with a '-' (say, '-abc'), then [2][3] behave differently from [1].
With [2] or [3], the <TAB> completes the file name '-abc', while with [1]
nothing is offered (I get a message 'no more arguments' due to a setting
in my .zshrc). The same applies to
% tail -- -<TAB>
I'm not sure whether the behavior of [1] (not offering '-abc') is the
expected one or not, and have no idea why '-abc' is offered by [2][3].
prev parent reply other threads:[~2015-10-28 12:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 13:44 Jun T.
2015-10-27 20:34 ` Daniel Shahaf
2015-10-27 20:54 ` Bart Schaefer
2015-10-28 12:56 ` Jun T. [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:
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=03DAC035-D571-4A2D-B60F-48C90AFDF2EC@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--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).