shell-completion: systemctl: do not list template units in {re,}start

Template units lacking DefaultInstance cannot be enabled/disabled or
started/restarted.

By adding DefaultInstance the unit can be enabled/disabled but it
still cannot be started/restarted.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Emil Velikov 2018-06-11 16:35:23 +01:00 committed by Emil Velikov
parent 98476dc8b2
commit 9b536b1af2
2 changed files with 4 additions and 6 deletions

View file

@ -235,13 +235,11 @@ _systemctl () {
compopt -o filenames
elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
comps=$( __get_startable_units $mode "$cur";
__get_template_names $mode "$cur")
comps=$( __get_startable_units $mode "$cur" )
compopt -o filenames
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
comps=$( __get_restartable_units $mode "$cur";
__get_template_names $mode "$cur")
comps=$( __get_restartable_units $mode "$cur" )
compopt -o filenames
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then

View file

@ -206,7 +206,7 @@ done
{
local _sys_startable_units; _systemctl_startable_units
_wanted systemd-units expl 'startable unit' \
compadd "$@" - ${_sys_startable_units[*]} $(_systemctl_get_template_names)
compadd "$@" - ${_sys_startable_units[*]}
}
# Completion functions for STOPPABLE_UNITS
@ -246,7 +246,7 @@ for fun in restart reload-or-restart ; do
{
local _sys_restartable_units; _systemctl_restartable_units
_wanted systemd-units expl 'restartable unit' \
compadd "$@" - ${_sys_restartable_units[*]} $(_systemctl_get_template_names)
compadd "$@" - ${_sys_restartable_units[*]}
}
done