diff options
author | Eric Cook <llua@gmx.com> | 2015-05-18 01:02:41 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-05-18 05:22:08 -0400 |
commit | 463985a9f489c54b89ee7ce6ffd67501035420b4 (patch) | |
tree | 700b38c7ad57f5ef837f3476745aac63325c93dc | |
parent | e4e868f3aeedccfe04c6b6c3be026c7f8873370a (diff) |
zsh-completion: less forking in _systemctl_failed_units() and make the array `_sys_failed_units' local to the completer.
-rw-r--r-- | shell-completion/zsh/_systemctl.in | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 304fec4782..a032ea245b 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -165,7 +165,7 @@ _systemctl_restartable_units(){ { while read -r a b; do echo -E - " $a"; done; } )) ) } -_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )} +_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --failed)"}%% *} ) } _systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) } local fun @@ -201,7 +201,7 @@ done # Completion functions for FAILED_UNITS (( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed() { - _systemctl_failed_units + local _sys_failed_units; _systemctl_failed_units compadd "$@" -a - _sys_failed_units || _message "no failed unit found" } |