From: Simon Barth Date: Mon, 10 Nov 2025 21:27:57 +0000 (+0100) Subject: shell-completion: bash: Add systemd-analyze filesystems X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62aba7c5cdb657f0194674b97fa216ce324bdb35;p=thirdparty%2Fsystemd.git shell-completion: bash: Add systemd-analyze filesystems --- diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index 8d055449412..a6861013b8d 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -56,6 +56,15 @@ __get_architectures() { systemd-analyze --no-legend --no-pager architectures 2>/dev/null | { while read -r a b; do echo " $a"; done; } } +__get_filesystem_sets() { + local line + systemd-analyze filesystems --no-pager 2>/dev/null | while IFS= read -r line; do + if [[ $line == @* ]]; then + printf '%s\n' "$line" + fi + done +} + _systemd_analyze() { local i verb comps mode local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword @@ -86,6 +95,7 @@ _systemd_analyze() { [TRANSIENT_SETTINGS]='transient-settings' [UNIT_SHELL]='unit-shell' [UNIT_GDB]='unit-gdb' + [FILESYSTEMS]='filesystems' ) local CONFIGS='locale.conf systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf @@ -265,6 +275,13 @@ _systemd_analyze() { else comps=$( __get_services $mode ) fi + + elif __contains_word "$verb" ${VERBS[FILESYSTEMS]}; then + if [[ $cur = -* ]]; then + comps='--help --version --no-pager' + else + comps=$( __get_filesystem_sets ) + fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") )