mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-07-27 11:42:33 +03:00
zsh-completion: fix completion of --user services
By the time __systemctl is called, --user/--system are shifted out of `words' by _arguments. This patch queries the array sooner. In the case that both --user and --system are on the line when compsys runs, _sys_service_mgr is set to the latter. Which is seemingly how systemctl behaves. If neither are on the line, --system is set; for system services to be completed.
This commit is contained in:
@ -93,9 +93,7 @@
|
|||||||
|
|
||||||
__systemctl()
|
__systemctl()
|
||||||
{
|
{
|
||||||
local -a _modes
|
systemctl $_sys_service_mgr --full --no-legend --no-pager "$@"
|
||||||
_modes=("--user" "--system")
|
|
||||||
systemctl ${words:*_modes} --full --no-legend --no-pager "$@"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -355,6 +353,8 @@ _job_modes() {
|
|||||||
_values -s , "${_modes[@]}"
|
_values -s , "${_modes[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local -a _modes; _modes=("--user" "--system")
|
||||||
|
local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}
|
||||||
_arguments -s \
|
_arguments -s \
|
||||||
{-h,--help}'[Show help]' \
|
{-h,--help}'[Show help]' \
|
||||||
'--version[Show package version]' \
|
'--version[Show package version]' \
|
||||||
|
Reference in New Issue
Block a user