summaryrefslogtreecommitdiff
path: root/shell-completion
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-05-11 04:11:56 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-05-11 04:11:56 +0900
commit581ab537407457373673724aa0fdbd6aeb0188f0 (patch)
tree7b94ac2951310bf59392374e3ad90addba73ea60 /shell-completion
parent7ee19d264390f6acad149bf364ffcd4500bf4524 (diff)
bash-completion: analyze: support cat-config verb
Follow-up for 854a42fb2e9db1b9eaa381559d7671f2e9b3a0f1.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/systemd-analyze19
1 files changed, 18 insertions, 1 deletions
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze
index 9c59429f0f..1d46a3c914 100644
--- a/shell-completion/bash/systemd-analyze
+++ b/shell-completion/bash/systemd-analyze
@@ -38,7 +38,7 @@ _systemd_analyze() {
local -A OPTS=(
[STANDALONE]='-h --help --version --system --user --global --order --require --no-pager
--man=no --generators=yes'
- [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern'
+ [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern --root'
)
local -A VERBS=(
@@ -50,8 +50,15 @@ _systemd_analyze() {
[VERIFY]='verify'
[SECCOMP_FILTER]='syscall-filter'
[SERVICE_WATCHDOGS]='service-watchdogs'
+ [CAT_CONFIG]='cat-config'
)
+ local CONFIGS='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/sleep.conf systemd/system.conf systemd/timedated.conf
+ systemd/timesyncd.conf systemd/user.conf udev/udev.conf'
+
_init_completion || return
for ((i=0; i < COMP_CWORD; i++)); do
@@ -132,6 +139,16 @@ _systemd_analyze() {
comps='on off'
fi
+ elif __contains_word "$verb" ${VERBS[CAT_CONFIG]}; then
+ if [[ $cur = -* ]]; then
+ comps='--help --version --root --no-pager'
+ elif [[ -z $cur ]]; then
+ comps="$CONFIGS"
+ compopt -o filenames
+ else
+ comps="$CONFIGS $( compgen -A file -- "$cur" )"
+ compopt -o filenames
+ fi
fi
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )