]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash completion: add systemd-analyze architectures 30643/head
authorLuca Boccassi <bluca@debian.org>
Wed, 27 Dec 2023 16:50:36 +0000 (17:50 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 27 Dec 2023 16:52:06 +0000 (17:52 +0100)
Follow-up for fb8cc599ed863502d67

shell-completion/bash/systemd-analyze

index 8ecf99357155e7b10ca4c68ff40410b6715f55d5..d27a6422207bea994e66a59c29b0b5ccc8aff14f 100644 (file)
@@ -51,6 +51,10 @@ __get_syscall_sets() {
     done
 }
 
+__get_architectures() {
+    systemd-analyze --no-legend --no-pager architectures | { while read -r a b; do echo " $a"; done }
+}
+
 _systemd_analyze() {
     local i verb comps mode
     local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
@@ -73,6 +77,7 @@ _systemd_analyze() {
         [CONDITION]='condition'
         [INSPECT_ELF]='inspect-elf'
         [PLOT]='plot'
+        [ARCHITECTURES]='architectures'
     )
 
     local CONFIGS='systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf
@@ -198,6 +203,13 @@ _systemd_analyze() {
         if [[ $cur = -* ]]; then
             comps='--help --version --system --user --global --no-pager --json=off --json=pretty --json=short --table --no-legend'
         fi
+
+    elif __contains_word "$verb" ${VERBS[ARCHITECTURES]}; then
+        if [[ $cur = -* ]]; then
+            comps='--help --version --no-pager --json=off --json=pretty --json=short --no-legend'
+        else
+            comps=$( __get_architectures )
+        fi
     fi
 
     COMPREPLY=( $(compgen -W '$comps' -- "$cur") )