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.
}
# 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]' \