From b3f76af401cb2d3f95c9b5975acec2caed1632d8 Mon Sep 17 00:00:00 2001 From: Ivan Kruglov Date: Wed, 12 Aug 2026 03:54:10 -0700 Subject: [PATCH] shell-completion: offer --json= for the standalone verbs that support it Several verbs in the STANDALONE bucket accept --json=, but that bucket only offers --help --version --system --user --global --no-pager, so completion never suggested the option for them. Split those verbs out into a new STANDALONE_JSON bucket that additionally offers --json=off/pretty/short. The verbs are moved rather than copied, as ${VERBS[*]} is used to complete the verb list itself. --- shell-completion/bash/systemd-analyze | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index b194c74b63..04b4e56e12 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -77,7 +77,8 @@ _systemd_analyze() { ) local -A VERBS=( - [STANDALONE]='time blame unit-files unit-paths exit-status compare-versions timestamp timespan pcrs nvpcrs srk has-tpm2 identify-tpm2 smbios11 chid image-policy' + [STANDALONE]='time unit-files unit-paths compare-versions timestamp timespan srk has-tpm2 smbios11 image-policy' + [STANDALONE_JSON]='blame exit-status pcrs nvpcrs identify-tpm2 chid' [CRITICAL_CHAIN]='critical-chain' [DOT]='dot' [DUMP]='dump' @@ -153,6 +154,11 @@ _systemd_analyze() { comps='--help --version --system --user --global --no-pager' fi + elif __contains_word "$verb" ${VERBS[STANDALONE_JSON]}; then + if [[ $cur = -* ]]; then + comps='--help --version --system --user --global --no-pager --json=off --json=pretty --json=short' + fi + elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then if [[ $cur = -* ]]; then comps='--help --version --system --user --fuzz --no-pager'