Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Use of (e:...:) glob qualifier with _files -g?
- X-seq: zsh-users 24395
- From: dana <dana@xxxxxxx>
- To: Chris Nebel <c.nebel@xxxxxxx>
- Subject: Re: Use of (e:...:) glob qualifier with _files -g?
- Date: Mon, 4 Nov 2019 00:56:47 -0600
- Cc: zsh-users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tVGfvOEiJSheNUHEPI2MdQb/IJayUPYMypxPQgPMkPs=; b=NlHrJjVNeM72sSm0UO5R4Tjszx1VVAk24GMceA451sU6KEZhWaZov9PuXylTXMzm4e nPkob5dfJUNKDuVJ/dbSOnEg5Tdyj75e+FnTN4N7b5mph5opAKxrTyQDYyf/00CdaRbD EFd8PZ6FhJfYcJNv717lgxW1c9AyUz/Ti6ozqgCsI1dLMPNMLFc5gM23nzJznVOHXoJj xRcRJcnfhPjYxIqOoO68bLNKly61/DD1w2OH5HLIUwkBRF6as6IaBikogyyJbGf06jYu TC4bONY0Pjrio9WKx4XY72X0sNTnfDlxx0GURcNRPE1scbAAVgTvYiGp58BeKB+YQcRP RwfA==
- In-reply-to: <206B06E5-8D28-4132-A0CC-BE070F9A5F7C@mac.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <206B06E5-8D28-4132-A0CC-BE070F9A5F7C@mac.com>
On 4 Nov 2019, at 00:08, Chris Nebel <c.nebel@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author