mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
shell-completion: bash: Add systemd-analyze filesystems
This commit is contained in:
@@ -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") )
|
||||
|
||||
Reference in New Issue
Block a user