zsh-users
 help / color / mirror / code / Atom feed
From: Chris Nebel <c.nebel@mac.com>
To: zsh-users@zsh.org
Subject: Use of (e:...:) glob qualifier with _files -g?
Date: Sun, 3 Nov 2019 22:08:04 -0800	[thread overview]
Message-ID: <206B06E5-8D28-4132-A0CC-BE070F9A5F7C@mac.com> (raw)

In an attempt to get my darwinup completer to only complete actual archive files, I’ve been playing with the shell code glob qualfiers.  For example, this will match everything file(1) says is an archive of some sort:

	*(e:'file -bz $REPLY | grep -wq archive')

Works great at the shell prompt, but I have been unable to use it — or pretty much any (e:…:) expression — with “_files -g”.  Since it seems to break as soon as I have a space in the expression, I suspect it’s some sort of quoting problem, but I’m stumped for a solution.  I do have a workaround, which is to define a function and use the “+” qualifier instead:

	_is_darwinup_root () {
	    file -bz $REPLY | grep -wq archive
	}

	_darwinup_roots () {
	    _files -g '*(+_is_darwinup_root)'
	}

…but that means one more global-namespace function that I’d rather not have.  Any tips?


—Chris N.

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04  6:08 Chris Nebel [this message]
2019-11-04  6:56 ` dana
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=206B06E5-8D28-4132-A0CC-BE070F9A5F7C@mac.com \
    --to=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).