|
Zbigniew Jędrzejewski-Szmek |
436654 |
From a27d1804a1a1d1f522fe7742f42a44ced58dce2e Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
From: Eric Cook <llua@gmx.com>
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
Date: Mon, 18 May 2015 18:45:31 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
Subject: [PATCH] zsh-completion: fix completion of --user services
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
By the time __systemctl is called, --user/--system are shifted out of
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
`words' by _arguments. This patch queries the array sooner.
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
In the case that both --user and --system are on the line when compsys runs,
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
_sys_service_mgr is set to the latter. Which is seemingly how systemctl behaves.
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
If neither are on the line, --system is set; for system services to be completed.
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
(cherry picked from commit 68c4f6d406a2bdac6957a67a077f182b0287cc3b)
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
shell-completion/zsh/_systemctl.in | 6 +++---
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
index 1dc6406beb..db9bdb60c5 100644
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
--- a/shell-completion/zsh/_systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
+++ b/shell-completion/zsh/_systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
@@ -93,9 +93,7 @@
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
__systemctl()
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
{
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
- local -a _modes
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
- _modes=("--user" "--system")
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
- systemctl ${words:*_modes} --full --no-legend --no-pager "$@"
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
+ systemctl $_sys_service_mgr --full --no-legend --no-pager "$@"
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
@@ -355,6 +353,8 @@ _job_modes() {
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
_values -s , "${_modes[@]}"
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
+local -a _modes; _modes=("--user" "--system")
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
+local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
_arguments -s \
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
{-h,--help}'[Show help]' \
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
'--version[Show package version]' \
|