summaryrefslogtreecommitdiff
path: root/shell-completion
diff options
context:
space:
mode:
authorg0tar <gotar@polanet.pl>2017-10-05 22:17:51 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-05 22:17:51 +0200
commit91277dff730769905754c137dcfcca579dea388d (patch)
treefeb7e2c59ab526607a1841371257ed116b2a4f95 /shell-completion
parent082827e6c6ca6272473450a8c1390dfc6054be78 (diff)
downloadsystemd-91277dff730769905754c137dcfcca579dea388d.tar.gz
pass currently completed word to systemctl list-unit-files/list-units (#6927)
This change noticeably increases completion performance at the expense of preventing possible _correct, _approximate or any matcher-list rules. Still, responsiveness increase so huge seems to make it worth the price.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/zsh/_systemctl.in16
1 files changed, 8 insertions, 8 deletions
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index aad700b739..d35c900f10 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -133,30 +133,30 @@ _filter_units_by_property() {
echo -E - "${(@g:o:)${(k@)props[(Re)$property=$value]}#Id=}"
}
-_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files)"}##*@.[^[:space:]]##}%%@.*}\@ }
+_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files "*$PREFIX*$SUFFIX*" )"}##*@.[^[:space:]]##}%%@.*}\@ }
-_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units)"}%% *} )}
+_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units "*$PREFIX*$SUFFIX*" )"}%% *} )}
_systemctl_startable_units(){
_sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
_filter_units_by_property CanStart yes $(
- __systemctl $mode list-unit-files --state enabled,disabled,static | \
+ __systemctl $mode list-unit-files --state enabled,disabled,static "*$PREFIX*$SUFFIX*" | \
{ while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; }
- __systemctl $mode list-units --state inactive,failed | \
+ __systemctl $mode list-units --state inactive,failed "*$PREFIX*$SUFFIX*" | \
{ while read -r a b; do echo -E - " $a"; done; } )) ) )
}
_systemctl_restartable_units(){
_sys_restartable_units=( $(_filter_units_by_property CanStart yes $(
- __systemctl $mode list-unit-files --state enabled,disabled,static | \
+ __systemctl $mode list-unit-files --state enabled,disabled,static "*$PREFIX*$SUFFIX*" | \
{ while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; }
- __systemctl $mode list-units | \
+ __systemctl $mode list-units "*$PREFIX*$SUFFIX*" | \
{ while read -r a b; do echo -E - " $a"; done; } )) )
}
-_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed)"}%% *} ) }
-_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) }
+_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed "*$PREFIX*$SUFFIX*" )"}%% *} ) }
+_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files "*$PREFIX*$SUFFIX*" ) ) }
local fun
# Completion functions for ALL_UNITS