From 5ee6d932fe185b8ae007bb47b34026308ac33623 Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@gmx.com>
Date: Mon, 18 May 2015 01:02:40 -0400
Subject: [PATCH] zsh-completion: less forking in
_systemctl_get_template_names()
(cherry picked from commit e4e868f3aeedccfe04c6b6c3be026c7f8873370a)
---
shell-completion/zsh/_systemctl.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index 427572355a..b8921791dd 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -143,7 +143,7 @@ _filter_units_by_property() {
done
}
-_systemctl_get_template_names() { __systemctl list-unit-files | { while read -r a b; do [[ $a =~ @\. ]] && echo -E - " ${a%%@.*}@"; done; } }
+_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files)"}##*@.[^[:space:]]##}%%@.*}\@ }
_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}