zsh-users
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Chris Nebel <c.nebel@mac.com>
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: Use of (e:...:) glob qualifier with _files -g?
Date: Mon, 4 Nov 2019 00:56:47 -0600	[thread overview]
Message-ID: <8F91689D-3069-4A1F-A4B2-3BF6F009B878@dana.is> (raw)
In-Reply-To: <206B06E5-8D28-4132-A0CC-BE070F9A5F7C@mac.com>

On 4 Nov 2019, at 00:08, Chris Nebel <c.nebel@mac.com> wrote:
> *(e:'file -bz $REPLY | grep -wq archive')

I'm not sure that's even a good idea. You'd be running an external process
against every single file the function encountered. On network drives or in
directories with many files that could take a while.

Also, i've never used darwinup, but it looks to me like it supports only a
select number of archive formats, which are guessed based on the file
extension and enumerated here:

https://github.com/macosforge/darwinbuild/blob/master/darwinup/Archive.cpp#L323

If that's the case, you should be able to just use '*.(tar|zip|whatever)',
which is much simpler and faster.

With that said, to answer your actual question, i think the reason it doesn't
work is that _files has an undocumented feature where if it detects unescaped
white space in the pattern it assumes that you're trying to supply *multiple*
patterns to be transformed into a brace expansion. Maybe there is some very
fancy quoting you can do to make that work, but at that point i think using
the + qualifier would be easier.

dana


  reply	other threads:[~2019-11-04  6:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04  6:08 Chris Nebel
2019-11-04  6:56 ` dana [this message]
2019-11-04 20:41   ` Chris Nebel
2019-11-04 20:50     ` Chris Nebel
2019-11-04 21:24     ` 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=8F91689D-3069-4A1F-A4B2-3BF6F009B878@dana.is \
    --to=dana@dana.is \
    --cc=c.nebel@mac.com \
    --cc=zsh-users@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).