From: Zbigniew Jędrzejewski-Szmek Date: Mon, 2 Jun 2025 18:42:54 +0000 (+0200) Subject: shell-completions: add systemd-analyze transient-settings X-Git-Tag: v258-rc1~183^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d971936bf4c39259774e363148c80dea5c93243d;p=thirdparty%2Fsystemd.git shell-completions: add systemd-analyze transient-settings 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. --- diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index 41a2151e127..e4ecafeddca 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -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") ) diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze index 50542b39628..e03ae31afd7 100644 --- a/shell-completion/zsh/_systemd-analyze +++ b/shell-completion/zsh/_systemd-analyze @@ -47,6 +47,13 @@ _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 )