chiark / gitweb /
systemctl: add commands set-default and get-default
[elogind.git] / shell-completion / bash / systemctl
index 191b8d13ec1264b4b27429bbf76f0d398706e21b..a05b756980d5afce4c305d62ef6e117c798bf275 100644 (file)
@@ -134,9 +134,10 @@ _systemctl () {
                [STANDALONE]='daemon-reexec daemon-reload default dump
                              emergency exit halt hibernate hybrid-sleep kexec list-jobs
                              list-units list-unit-files poweroff reboot rescue
-                             show-environment suspend'
+                             show-environment suspend get-default'
                      [NAME]='snapshot load'
                      [FILE]='link'
+                  [TARGETS]='set-default'
         )
 
         for ((i=0; $i <= $COMP_CWORD; i++)); do
@@ -210,6 +211,9 @@ _systemctl () {
         elif __contains_word "$verb" ${VERBS[FILE]}; then
                 comps=$( compgen -A file -- "$cur" )
                 compopt -o filenames
+        elif __contains_word "$verb" ${VERBS[TARGETS]}; then
+                comps=$( __systemctl $mode list-unit-files --type target --full --all \
+                        | { while read -r a b; do echo " $a"; done; } )
         fi
 
         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )