ryantimwilson / rpms / systemd

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