]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
zsh: fix disable/enable completion
authorHaochen Tong <i@hexchain.org>
Sun, 26 Apr 2020 22:30:49 +0000 (00:30 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 27 Apr 2020 06:12:27 +0000 (08:12 +0200)
The "preset" column introduced in
b01c1f305c044a381ad110709a62507d74bf6d86 breaks zsh completion for
systemctl disable/enable. Fix by ignoring everything after the last
space in a line.

shell-completion/zsh/_systemctl.in

index c067bf8f2792ba50c5bd9b4b8ef3f62fa5c9eb9e..582d469c350e660a3eb68cd5f9cb19a2bb0678d6 100644 (file)
@@ -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