Blob Blame History Raw
From 19c1015ce732c387cae8d0a2b116eb2022087ca2 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 23 Sep 2014 14:59:11 +0200
Subject: [PATCH] bash-completion: add verb set-property

not in upstream yet

Resolves: #1235635
---
 shell-completion/bash/systemctl.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
index 3d787cdb77..496c756a43 100644
--- a/shell-completion/bash/systemctl.in
+++ b/shell-completion/bash/systemctl.in
@@ -96,6 +96,12 @@ _systemctl () {
                       [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
         )
 
+        local -A PROPS='CPUQuota= CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= SendSIGKILL= WakeSystem=
+        DefaultDependencies= MemoryLimit= CPUShares= BlockIOWeight= User= Group= DevicePolicy= KillMode= DeviceAllow=
+        BlockIOReadBandwidth= BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= KillSignal= AccuracySec=
+        LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= LimitMEMLOCK=
+        LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= LimitNICE= LimitRTPRIO= LimitRTTIME='
+
         if __contains_word "--user" ${COMP_WORDS[*]}; then
             mode=--user
         else
@@ -153,6 +159,7 @@ _systemctl () {
              [MASKED_UNITS]='unmask'
                      [JOBS]='cancel'
                 [SNAPSHOTS]='delete'
+               [PROPERTIES]='set-property'
                      [ENVS]='set-environment unset-environment'
                [STANDALONE]='daemon-reexec daemon-reload default
                              emergency exit halt hibernate hybrid-sleep kexec list-jobs
@@ -258,6 +265,13 @@ _systemctl () {
         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; } )
+        elif __contains_word "$verb" ${VERBS[PROPERTIES]}; then
+                if __contains_word "$prev" ${VERBS[PROPERTIES]}; then
+                        comps=$( __get_active_units $mode )
+                else
+                        comps=$PROPS
+                        compopt -o nospace
+                fi
         fi
 
         COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") )