summaryrefslogtreecommitdiff
path: root/shell-completion
diff options
context:
space:
mode:
authorHaochen Tong <i@hexchain.org>2020-04-27 00:30:49 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-27 08:12:27 +0200
commitf5b3be308d1c72c34b1204702a21233b6585b533 (patch)
treeb8e93cf2fd2fc98bad88cd195ff4c7ae23d6020e /shell-completion
parent3c14dc61f7782d8eca0ff7b55e9f60fef176fe82 (diff)
downloadsystemd-f5b3be308d1c72c34b1204702a21233b6585b533.tar.gz
zsh: fix disable/enable completion
The "preset" column introduced in b01c1f305c044a381ad110709a62507d74bf6d86 breaks zsh completion for systemctl disable/enable. Fix by ignoring everything after the last space in a line.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/zsh/_systemctl.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index c067bf8f27..582d469c35 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -221,7 +221,11 @@ __systemctl()
_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed "$PREFIX*" )"}%% *} ) }
(( $+functions[_systemctl_unit_state] )) ||
- _systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files "$PREFIX*" ) ) }
+ _systemctl_unit_state() {
+ setopt localoptions extendedglob
+ typeset -gA _sys_unit_state
+ _sys_unit_state=( ${=${${(f)"$(__systemctl list-unit-files "$PREFIX*" )"}%%[[:space:]]#}% *} )
+ }
local fun
# Completion functions for ALL_UNITS