From: Ronan Pigott Date: Mon, 17 Jul 2023 21:47:23 +0000 (-0700) Subject: zsh: default to system manager when not specified X-Git-Tag: v254-rc3~10^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=087f777a1cd946b91ae4013f0a3b0b6e3c333d97;p=thirdparty%2Fsystemd.git 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. --- diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 666649e858b..98b4d2eb65b 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]' \