Zsh Mailing List Archive
Messages sorted by:
Re: [Bulk] Re: [PATCH] Add xxd completion
- X-seq: zsh-workers 33432
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: [Bulk] Re: [PATCH] Add xxd completion
- Date: Sat, 11 Oct 2014 11:46:21 +0200
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1413020782; bh=sVf4sBdVW/KvYtKgP0eIAQ3z//v1+Rqq3jvZUxBqgxc=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=QrAQtIsSEK5XiRTHPcsi+SkPEbp33ZgXlCtHRoYbz5Ji0L9VLKvLagArwozslnVL0ZkAwzQfm2PUkWXlZxh75he+eQhQGnYTgoxXcPf/ZoM1CvvwYalb6THrECsi+cJRi7aNMQxKp2Fp9MULt8SgD4Iafv/klfAjkCVkeDJDl7Q=
- In-reply-to: <20141009082124.GC1737@tarsus.local2>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20141008082016.GC1712@tarsus.local2> <email@example.com> <20141009082124.GC1737@tarsus.local2>
Daniel Shahaf wrote:
> Thanks for the review.
[ snip ]
As you may have noticed, I've now pushed _xxd.
> > > +# TODO: xxd -<tab> should show '-x' and '-x:' differently - give visual hint that there's a required argument
> > Unless I'm missing something, there's nothing xxd specific in that
> > desire. Perhaps it should be considered for the general case. In many
> Yes, that's a general issue. For example, instead of:
> -u -- user name
> I would prefer:
> -u + -- user name
If you want to dig into the code, it should be possible to make
_arguments do that: match descriptions can differ from the actual match.
I'm not sure how useful it would really be in practice. It'd also need
to allow for optional arguments, and cases where it is -u=USER or
-uUSER. While I say it would be possible, it wouldn't be easy.
> Incidentally, I ran into another general issue:
> It wasn't immediately obvious to me, but I eventually realized the "-z" in the
> output was caused by a stray file named "-z" (via the _files completion defined
> for positional arguments). However, since the filename begins with a hyphen,
> specifying it as "-z" won't work as intended. Perhaps "xxd -<tab>" should
> offer "./-z" or "-- -z" (two words) as possible completions?
The -- and ./ tricks won't work for all commands and aren't always
necessary. We'd need to handle it in lots of functions. Files starting
with a - are rare, and usually a mistake. Perhaps it'd be worth doing in
_rm as much to see what it involves. Maybe _files should be cleverer,
perhaps also putting the (-.) in globs by default too.
> Done. 'xxd -grou<tab>' now DTRTs; however, 'xxd -g<tab>' gives me:
> % xxd -g<tab>
> -groupsize -- specify the number of octets per group
> and the display doesn't change even if I press <tab> again. This seems odd:
> why am I not offered both -g and -groupsize as possible completions? And if
> "-groupsize" is offered in the message, why does pressing <tab> not complete
> the command-line word to the one possible completion?
It'll perhaps seem clearer if you set the format style with the
descriptions tag, e.g:
zstyle ':completion:*:descriptions' format '%B%d%b'
You may also need this:
zstyle ':completion:*' group-name ''
This makes it clearer that you have two groups, one of which has no
associated matches, just a heading.
What subsequent tab presses does, depends a lot on your configuration.
Messages sorted by: