summaryrefslogtreecommitdiff
path: root/shell-completion
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-05-28 14:57:00 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-05-28 18:15:00 +0900
commitaea447c9f8d85b056d803dffae351a35b1158585 (patch)
tree09aa3233755dd018dfc9a07029b2d4e79cb4c0f8 /shell-completion
parentdd74faef7a6b8448f53eeb055809bc8ea9ae82f5 (diff)
bash-completion: also suggest template unit files
Fixes #9041.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/systemctl.in9
1 files changed, 8 insertions, 1 deletions
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
index 4a0ceb879a..8bf83c8aea 100644
--- a/shell-completion/bash/systemctl.in
+++ b/shell-completion/bash/systemctl.in
@@ -62,6 +62,8 @@ __filter_units_by_properties () {
}
__get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \
+ | { while read -r a b; do echo " $a"; done; }; }
+__get_non_template_units() { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \
| { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; }
__get_template_names () { __systemctl $1 list-unit-files \
| { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; }
@@ -172,7 +174,8 @@ _systemctl () {
fi
local -A VERBS=(
- [ALL_UNITS]='is-active is-failed is-enabled status show cat mask preset help list-dependencies edit set-property revert'
+ [ALL_UNITS]='cat mask'
+ [NONTEMPLATE_UNITS]='is-active is-failed is-enabled status show preset help list-dependencies edit set-property revert'
[ENABLED_UNITS]='disable'
[DISABLED_UNITS]='enable'
[REENABLABLE_UNITS]='reenable'
@@ -212,6 +215,10 @@ _systemctl () {
comps=$( __get_all_units $mode )
compopt -o filenames
+ elif __contains_word "$verb" ${VERBS[NONTEMPLATE_UNITS]}; then
+ comps=$( __get_non_template_units $mode )
+ compopt -o filenames
+
elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
comps=$( __get_enabled_units $mode )
compopt -o filenames