X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=shell-completion%2Fbash%2Fsystemctl.in;h=afa80dad727178ab78c220d8700937957b0becfa;hb=e9a19bd882ff8a2c8aef5c63b39525ea231e5fb9;hp=bca02310a9bd99d2ce035c9f2c4bfbe3a9a7cce1;hpb=f29c77bc0179b0fa57407dbe30b495be9f5ad2e8;p=elogind.git diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index bca02310a..afa80dad7 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -53,6 +53,9 @@ __filter_units_by_property () { __get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \ | { while read -r a b; do echo " $a"; done; }; } +__get_template_names () { __systemctl $1 list-unit-files \ + | { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; } + __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } __get_startable_units () { @@ -169,22 +172,26 @@ _systemctl () { compopt -o filenames elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then - comps=$( __get_disabled_units $mode ) + comps=$( __get_disabled_units $mode; + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then comps=$( __get_disabled_units $mode; - __get_enabled_units $mode ) + __get_enabled_units $mode; + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ - $( __get_startable_units $mode)) + $( __get_startable_units $mode); + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ - $( __get_restartable_units $mode)) + $( __get_restartable_units $mode); \ + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then