zsh-users
 help / color / mirror / code / Atom feed
* Use of (e:...:) glob qualifier with _files -g?
@ 2019-11-04  6:08 Chris Nebel
  2019-11-04  6:56 ` dana
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Nebel @ 2019-11-04  6:08 UTC (permalink / raw)
  To: zsh-users

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-04 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04  6:08 Use of (e:...:) glob qualifier with _files -g? Chris Nebel
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

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).