daandemeyer / rpms / systemd

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