|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From e44731b91ad77e04bf26de21d1605bbe342577c6 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Date: Wed, 29 Oct 2014 23:06:58 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Subject: [PATCH] bash-completion: use improved filtering to make things faster
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
(cherry picked from commit 372b221166eb586c4f767969f442ed940e21f353)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
shell-completion/bash/systemctl.in | 16 +++++++++++-----
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
index 9e538a9a5b..9e98a1850e 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
--- a/shell-completion/bash/systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+++ b/shell-completion/bash/systemctl.in
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -60,14 +60,20 @@ __get_active_units () { __systemctl $1 list-units \
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
| { while read -r a b; do echo " $a"; done; }; }
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
__get_startable_units () {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
# find startable inactive units
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- __filter_units_by_property $mode LoadState loaded $(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- __filter_units_by_property $mode ActiveState inactive $(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- __filter_units_by_property $mode CanStart yes $( __get_all_units )))
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __filter_units_by_property $mode ActiveState inactive $(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __filter_units_by_property $mode CanStart yes $(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __systemctl $mode list-unit-files --state enabled,disabled,static | \
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __systemctl $mode list-units --state inactive,failed | \
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ { while read -r a b; do echo " $a"; done; } ))
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
__get_restartable_units () {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
# filter out masked and not-found
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- __filter_units_by_property $mode LoadState loaded $(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- __filter_units_by_property $mode CanStart yes $( __get_all_units ))
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __filter_units_by_property $mode CanStart yes $(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __systemctl $mode list-unit-files --state enabled,disabled,static | \
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ __systemctl $mode list-units | \
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ { while read -r a b; do echo " $a"; done; } )
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
__get_failed_units () { __systemctl $1 list-units \
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
| { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
|