Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Use of (e:...:) glob qualifier with _files -g?



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.


Messages sorted by: Reverse Date, Date, Thread, Author