]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash completion: add systemctl service-log-level/target
authorLuca Boccassi <bluca@debian.org>
Wed, 27 Dec 2023 15:59:03 +0000 (16:59 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 27 Dec 2023 15:59:03 +0000 (16:59 +0100)
shell-completion/bash/systemctl.in

index 03c3b7015048df24851c8f2b76b44bfe7099fb1a..ef8cd8f4be2dc658bf2fa268663a47f3c47ee602 100644 (file)
@@ -236,6 +236,8 @@ _systemctl () {
         [MACHINES]='list-machines'
         [LOG_LEVEL]='log-level'
         [LOG_TARGET]='log-target'
+        [SERVICE_LOG_LEVEL]='service-log-level'
+        [SERVICE_LOG_TARGET]='service-log-target'
         [SERVICE_WATCHDOGS]='service-watchdogs'
     )
 
@@ -365,6 +367,22 @@ _systemctl () {
         comps='debug info notice warning err crit alert emerg'
     elif __contains_word "$verb" ${VERBS[LOG_TARGET]}; then
         comps='console journal kmsg journal-or-kmsg null'
+    elif __contains_word "$verb" ${VERBS[SERVICE_LOG_LEVEL]}; then
+        if __contains_word "$prev" ${VERBS[SERVICE_LOG_LEVEL]}; then
+            comps=$( __get_all_unit_files $mode "$cur" )
+        elif __contains_word "$prev" debug info notice warning err crit alert emerg; then
+            return 0
+        else
+            comps='debug info notice warning err crit alert emerg'
+        fi
+    elif __contains_word "$verb" ${VERBS[SERVICE_LOG_TARGET]}; then
+        if __contains_word "$prev" ${VERBS[SERVICE_LOG_TARGET]}; then
+            comps=$( __get_all_unit_files $mode "$cur" )
+        elif __contains_word "$prev" console journal kmsg journal-or-kmsg null; then
+            return 0
+        else
+            comps='console journal kmsg journal-or-kmsg null'
+        fi
     elif __contains_word "$verb" ${VERBS[SERVICE_WATCHDOGS]}; then
         comps='on off'
     fi