Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Use of (e:...:) glob qualifier with _files -g?
- X-seq: zsh-users 24394
- From: Chris Nebel <c.nebel@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Use of (e:...:) glob qualifier with _files -g?
- Date: Sun, 3 Nov 2019 22:08:04 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1572847685; bh=+YvEOH9eqyKUsDaxM9gyWg9dMgBQX2nLOoFjIKBqZ0E=; h=From:Content-Type:Subject:Message-Id:Date:To; b=ZqbczssvuSujm0CBoTPJ1pQlFTZ3ZgvR0a0SWmTVPPyf4s7L8qjBAuaVAryqQ4pQ3 k8QJUjGLkID6oizC6OGCwbonoycxO5KaPOVRYbbbaRCJchY3OQSHpVRFRt1OhDCOs3 kyF0uGghilj90gapovSot+DR1zU9Sjzi+Ty1ReZaEv0pctk8a/tyfxrXkX40SyARX1 4D+s/DVQ+Lx9Gzzx+vgPgCBn1gSQ+j8Rm1LvhUemJlIC0Nc1L7bglKa4Nk6hXAqOus 99zi2vV/+bjMGOg/Wj7yPdGon7Zxrz2fLa85V7bjb8YcCp/0veGTp3UseD4iFeq7wj u2V+RDYDZmUsQ==
- 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
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