diff options
Diffstat (limited to '')
-rw-r--r-- | shell-completion/bash/systemd-analyze | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index 1fde672..75ea1dc 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-analyze(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -51,6 +52,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 @@ -62,7 +67,7 @@ _systemd_analyze() { ) local -A VERBS=( - [STANDALONE]='time blame unit-paths exit-status calendar timestamp timespan' + [STANDALONE]='time blame unit-files unit-paths exit-status capability compare-versions calendar timestamp timespan pcrs srk' [CRITICAL_CHAIN]='critical-chain' [DOT]='dot' [DUMP]='dump' @@ -73,11 +78,13 @@ _systemd_analyze() { [CONDITION]='condition' [INSPECT_ELF]='inspect-elf' [PLOT]='plot' + [ARCHITECTURES]='architectures' + [FDSTORE]='fdstore' ) - local CONFIGS='systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf + local CONFIGS='locale.conf systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf systemd/journal-remote.conf systemd/journal-upload.conf systemd/logind.conf - systemd/resolved.conf systemd/networkd.conf systemd/resolved.conf + systemd/resolved.conf systemd/networkd.conf systemd/pstore.conf systemd/resolved.conf systemd/sleep.conf systemd/system.conf systemd/timedated.conf systemd/timesyncd.conf systemd/user.conf udev/udev.conf' @@ -198,6 +205,20 @@ _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 + + elif __contains_word "$verb" ${VERBS[FDSTORE]}; then + if [[ $cur = -* ]]; then + comps='--help --version --system --user --global -H --host -M --machine --no-pager --json=off --json=pretty --json=short --root --image' + else + comps=$( __get_services $mode ) + fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) |