From 087f777a1cd946b91ae4013f0a3b0b6e3c333d97 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Mon, 17 Jul 2023 14:47:23 -0700 Subject: [PATCH] zsh: default to system manager when not specified This used to work correctly, before the change was reverted in e09d0d46c297. In fact it is important to specify the manager explicity in the completion because the argument is reused in the caching policies. An empty argument here caused the completion to create separate caches with and without the --system parameter. We can simplify the given pattern a little here too. --- shell-completion/zsh/_systemctl.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 666649e858..98b4d2eb65 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -491,9 +491,8 @@ done } # Build arguments for "systemctl" to be used in completion. -local -a _modes; _modes=("--user" "--system") -# Use the last mode (they are exclusive and the last one is used). -local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]} +# Use the last mode, or --system (they are exclusive and the last one is used). +local _sys_service_mgr=${words[(R)(--user|--system)]:---system} _arguments -s \ {-h,--help}'[Show help]' \ '--version[Show package version]' \ -- 2.25.1