]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash-completion: move shell-completion for log-level or friends to systemctl
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Dec 2019 02:29:11 +0000 (11:29 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 21 Dec 2019 18:23:02 +0000 (19:23 +0100)
shell-completion/bash/systemctl.in
shell-completion/bash/systemd-analyze

index 1bda6f2b7c1739047346804459a09e572cba6c67..7d2f0f88a2d161f0408b152ac9c3dbc9ddcfcad5 100644 (file)
@@ -211,6 +211,9 @@ _systemctl () {
         [FILE]='link switch-root'
         [TARGETS]='set-default'
         [MACHINES]='list-machines'
+        [LOG_LEVEL]='log-level'
+        [LOG_TARGET]='log-target'
+        [SERVICE_WATCHDOGS]='service-watchdogs'
     )
 
     for ((i=0; i < COMP_CWORD; i++)); do
@@ -326,6 +329,12 @@ _systemctl () {
     elif __contains_word "$verb" ${VERBS[TARGETS]}; then
         comps=$( __systemctl $mode list-unit-files --type target --full --all "$cur*" \
                      | { while read -r a b; do echo " $a"; done; } )
+    elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then
+        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_WATCHDOGS]}; then
+        comps='on off'
     fi
 
     COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur_orig") )
index 88688f7272330ba3de14b3340ccfac0d94e5a9eb..986dad5d5892d377ebdd02e5fc775b21cfda7352 100644 (file)
@@ -58,11 +58,8 @@ _systemd_analyze() {
         [STANDALONE]='time blame plot dump unit-paths exit-status condition calendar timestamp timespan'
         [CRITICAL_CHAIN]='critical-chain'
         [DOT]='dot'
-        [LOG_LEVEL]='log-level'
-        [LOG_TARGET]='log-target'
         [VERIFY]='verify'
         [SECCOMP_FILTER]='syscall-filter'
-        [SERVICE_WATCHDOGS]='service-watchdogs'
         [CAT_CONFIG]='cat-config'
         [SECURITY]='security'
     )
@@ -119,20 +116,6 @@ _systemd_analyze() {
             comps='--help --version --system --user --global --from-pattern --to-pattern --order --require'
         fi
 
-    elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then
-        if [[ $cur = -* ]]; then
-            comps='--help --version --system --user'
-        else
-            comps='debug info notice warning err crit alert emerg'
-        fi
-
-    elif __contains_word "$verb" ${VERBS[LOG_TARGET]}; then
-        if [[ $cur = -* ]]; then
-            comps='--help --version --system --user'
-        else
-            comps='console journal kmsg journal-or-kmsg null'
-        fi
-
     elif __contains_word "$verb" ${VERBS[SECCOMP_FILTER]}; then
         if [[ $cur = -* ]]; then
             comps='--help --version --no-pager'
@@ -148,13 +131,6 @@ _systemd_analyze() {
             compopt -o filenames
         fi
 
-    elif __contains_word "$verb" ${VERBS[SERVICE_WATCHDOGS]}; then
-        if [[ $cur = -* ]]; then
-            comps='--help --version --system --user'
-        else
-            comps='on off'
-        fi
-
     elif __contains_word "$verb" ${VERBS[CAT_CONFIG]}; then
         if [[ $cur = -* ]]; then
             comps='--help --version --root --no-pager'