From: Ronan Pigott Date: Wed, 19 Jul 2023 21:26:14 +0000 (-0700) Subject: zsh: use glob matching for template names X-Git-Tag: v254-rc3~10^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28436%2Fhead;p=thirdparty%2Fsystemd.git zsh: use glob matching for template names Template names can be learned from the filesystem, so there isn't a need to parse the output of systemctl list-unit-files in this case. This should accelerate the completion of some verbs like enable. --- diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 85ea6d28f57..7ce7c4c0154 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -200,7 +200,10 @@ __systemctl() )"}:#*@.*}%%[[:space:]]*} } (( $+functions[_systemctl_get_template_names] )) || - _systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files)"}##*@.[^[:space:]]##}%%@.*}\@ } + _systemctl_get_template_names() { + local pathkind=systemd-search-${_sys_service_mgr##*--}-unit + print -r - ${(s-:-)^$(_call_program $pathkind systemd-path $pathkind)}/*@.(${(~j.|.)$(__systemctl --type=help)})(N:t:r) + } (( $+functions[_systemctl_active_units] )) || _systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units)"}%% *} )}