|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
From 8d660f18b2b967f43b5891958553f0319d4f9f02 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
From: Eric Cook <llua@gmx.com>
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
Date: Mon, 18 May 2015 01:02:41 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
Subject: [PATCH] zsh-completion: less forking in _systemctl_failed_units() and
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
make the array `_sys_failed_units' local to the completer.
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
(cherry picked from commit 463985a9f489c54b89ee7ce6ffd67501035420b4)
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
shell-completion/zsh/_systemctl.in | 4 ++--
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
index b8921791dd..e95b7d3af0 100644
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
--- a/shell-completion/zsh/_systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
+++ b/shell-completion/zsh/_systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
@@ -165,7 +165,7 @@ _systemctl_restartable_units(){
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
{ while read -r a b; do echo -E - " $a"; done; } )) )
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
-_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
+_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --failed)"}%% *} ) }
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) }
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
local fun
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
@@ -201,7 +201,7 @@ done
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
# Completion functions for FAILED_UNITS
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
{
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
- _systemctl_failed_units
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
+ local _sys_failed_units; _systemctl_failed_units
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
a48f80 |
|