]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shell-completions: add systemd-analyze transient-settings
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 2 Jun 2025 18:42:54 +0000 (20:42 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 3 Jul 2025 19:03:26 +0000 (21:03 +0200)
The zsh completions only complete one type argument, even though multiple
args are allowed. But the same issue occurs with other completions, e.g.
for options. I don't know how to solve this.

shell-completion/bash/systemd-analyze
shell-completion/zsh/_systemd-analyze

index 41a2151e12757851592107ba1317e621a9de914c..e4ecafeddca27744c2b2c275dd5bc81fcc0c3664 100644 (file)
@@ -81,6 +81,7 @@ _systemd_analyze() {
         [ARCHITECTURES]='architectures'
         [FDSTORE]='fdstore'
         [CAPABILITY]='capability'
+        [TRANSIENT_SETTINGS]='transient-settings'
     )
 
     local CONFIGS='locale.conf systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf
@@ -225,6 +226,13 @@ _systemd_analyze() {
         if [[ $cur = -* ]]; then
             comps='--help --version --no-pager --json=off --json=pretty --json=short -m --mask'
         fi
+
+    elif __contains_word "$verb" ${VERBS[TRANSIENT_SETTINGS]}; then
+        if [[ $cur = -* ]]; then
+            comps='--help --version --no-pager'
+        else
+            comps="$(systemctl --no-legend --no-pager -t help)"
+        fi
     fi
 
     COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
index 50542b396287316525a82ebd9173a0496bdadfa4..e03ae31afd7d43d257685d1ba90fb7eada319985 100644 (file)
         _describe 'plot options' _options
     }
 
+(( $+functions[_systemd-analyze_transient-settings] )) ||
+    _systemd-analyze_transient-settings() {
+        local -a _types
+        _types=( $(systemctl --no-pager --no-legend -t help) )
+        _describe -t types 'unit types' _types
+    }
+
 (( $+functions[_systemd-analyze_commands] )) ||
     _systemd-analyze_commands(){
         local -a _systemd_analyze_cmds
@@ -74,6 +81,7 @@ JSON or table format'
             'security:Analyze security settings of a service'
             'inspect-elf:Parse and print ELF package metadata'
             'has-tpm2:Report whether TPM2 support is available'
+            'transient-settings:List transient settings for unit types'
             # log-level, log-target, service-watchdogs have been deprecated
         )