]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
zsh: default to system manager when not specified
authorRonan Pigott <ronan@rjp.ie>
Mon, 17 Jul 2023 21:47:23 +0000 (14:47 -0700)
committerRonan Pigott <ronan@rjp.ie>
Mon, 17 Jul 2023 23:35:29 +0000 (16:35 -0700)
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

index 666649e858b9244e60dcd4d9bae0c8a3785511cc..98b4d2eb65baeda241734ab50af378faab5aef2e 100644 (file)
@@ -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]' \