923a60
From 19c1015ce732c387cae8d0a2b116eb2022087ca2 Mon Sep 17 00:00:00 2001
923a60
From: Lukas Nykryn <lnykryn@redhat.com>
923a60
Date: Tue, 23 Sep 2014 14:59:11 +0200
923a60
Subject: [PATCH] bash-completion: add verb set-property
923a60
923a60
not in upstream yet
923a60
923a60
Resolves: #1235635
923a60
---
923a60
 shell-completion/bash/systemctl.in | 14 ++++++++++++++
923a60
 1 file changed, 14 insertions(+)
923a60
923a60
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
923a60
index 3d787cdb77..496c756a43 100644
923a60
--- a/shell-completion/bash/systemctl.in
923a60
+++ b/shell-completion/bash/systemctl.in
923a60
@@ -96,6 +96,12 @@ _systemctl () {
923a60
                       [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
923a60
         )
923a60
 
923a60
+        local -A PROPS='CPUQuota= CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= SendSIGKILL= WakeSystem=
923a60
+        DefaultDependencies= MemoryLimit= CPUShares= BlockIOWeight= User= Group= DevicePolicy= KillMode= DeviceAllow=
923a60
+        BlockIOReadBandwidth= BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= KillSignal= AccuracySec=
923a60
+        LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= LimitMEMLOCK=
923a60
+        LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= LimitNICE= LimitRTPRIO= LimitRTTIME='
923a60
+
923a60
         if __contains_word "--user" ${COMP_WORDS[*]}; then
923a60
             mode=--user
923a60
         else
923a60
@@ -153,6 +159,7 @@ _systemctl () {
923a60
              [MASKED_UNITS]='unmask'
923a60
                      [JOBS]='cancel'
923a60
                 [SNAPSHOTS]='delete'
923a60
+               [PROPERTIES]='set-property'
923a60
                      [ENVS]='set-environment unset-environment'
923a60
                [STANDALONE]='daemon-reexec daemon-reload default
923a60
                              emergency exit halt hibernate hybrid-sleep kexec list-jobs
923a60
@@ -258,6 +265,13 @@ _systemctl () {
923a60
         elif __contains_word "$verb" ${VERBS[TARGETS]}; then
923a60
                 comps=$( __systemctl $mode list-unit-files --type target --full --all \
923a60
                         | { while read -r a b; do echo " $a"; done; } )
923a60
+        elif __contains_word "$verb" ${VERBS[PROPERTIES]}; then
923a60
+                if __contains_word "$prev" ${VERBS[PROPERTIES]}; then
923a60
+                        comps=$( __get_active_units $mode )
923a60
+                else
923a60
+                        comps=$PROPS
923a60
+                        compopt -o nospace
923a60
+                fi
923a60
         fi
923a60
 
923a60
         COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") )