From: Bruce Stephens <b.stephens@isode.com>
To: zsh-users@math.gatech.edu
Subject: Re: Completion for gtar
Date: 26 Aug 1998 11:12:31 +0100 [thread overview]
Message-ID: <vbhfz09hm8.fsf@snake.isode.com> (raw)
In-Reply-To: "Bart Schaefer"'s message of "Tue, 25 Aug 1998 10:48:31 -0700"
"Bart Schaefer" <schaefer@brasslantern.com> writes:
> Have you looked at PWS's tar completion in Misc/compctl-examples in
> 3.1.4? It even has a function to extract completable file names
> from the tar file.
No, I hadn't. Partly deliberately---this was as much an exercise as
anything. Now I look at it, and the two look reassuringly similar,
although PWS's provides more.
> You can just do
>
> compctl -f -x 'p[1]' -k taropts -- gtar
>
> unless you want to unset taropts and not have it hanging around.
Yes. Or rather, I didn't want to rely on taropts sticking around.
> I don't think that means what you think it means. If you put the "-"
> in the list of -g patterns, then it's treated as a file name. It just
> so happens that, because it has no wildcards, it never gets dropped
> from the list of completions. So you'll find that you can complete
> e.g. like this:
>
> zsh% gtar zxf ~/<TAB>
> zsh% gtar zxf ~/-
>
> even when there's no file named "-" in your home dir.
That's clearly not what I want. You're right, there's no advantage in
having - complete to itself, so I ought to remove it.
> compctl -f -x 'p[1]' -k taropts \
> - 'p[2] W[1,*z*]' -/g '*.tar.(gz|Z)' -k '(-)' \
> -- gtar
>
> BTW, don't you want to add W[1,*f*] to that? You don't want to complete
> file names if there's no "f" option.
I don't care about not having the f option---I never use gtar except
on files. (Backups and so on are done differently, and by somebody
else.)
> That is what alternation is about, but alternation works differently.
> The -x branches are short-circuited on whether their patterns match, so
> once you take a -x branch you can never see completions from any of the
> other branches, even if no completions result from the branch where the
> patterns matched.
>
> Alternation with "+", on the other hand, short-circuits on whether the
> list of possible completions is empty, so it'll keep trying until it
> runs out of alternatives or finds one that produces something.
OK. I don't think this is clear from the documentation. Not as clear
as the two paragraphs you've just given, anyway.
next prev parent reply other threads:[~1998-08-26 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-25 15:29 Bruce Stephens
1998-08-25 17:48 ` Bart Schaefer
1998-08-25 18:23 ` error value from pipe Stephen Ng
1998-08-26 10:12 ` Bruce Stephens [this message]
[not found] <199808260818.KAA00478@beta.informatik.hu-berlin.de>
1998-08-26 10:05 ` Completion for gtar Bruce Stephens
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=vbhfz09hm8.fsf@snake.isode.com \
--to=b.stephens@isode.com \
--cc=zsh-users@math.gatech.edu \
/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).