zsh-completion: less forking in _systemctl_get_template_names()
authorEric Cook <llua@gmx.com>
Mon, 18 May 2015 05:02:40 +0000 (01:02 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 18 May 2015 09:22:08 +0000 (05:22 -0400)
shell-completion/zsh/_systemctl.in

index fc9fc2e..304fec4 100644 (file)
@@ -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; }) )}