summaryrefslogtreecommitdiff
path: root/shell-completion/bash/systemd-cgtop
diff options
context:
space:
mode:
Diffstat (limited to 'shell-completion/bash/systemd-cgtop')
-rw-r--r--shell-completion/bash/systemd-cgtop25
1 files changed, 23 insertions, 2 deletions
diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop
index 50464990ab..f1ed22fd55 100644
--- a/shell-completion/bash/systemd-cgtop
+++ b/shell-completion/bash/systemd-cgtop
@@ -24,17 +24,38 @@ __contains_word() {
done
}
+__get_machines() {
+ local a b
+ machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
+}
+
_systemd_cgtop() {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local comps
local -A OPTS=(
- [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -n --iterations -d --delay'
- [ARG]='--cpu --depth'
+ [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -r --raw -k -P'
+ [ARG]='--cpu --depth -M --machine --recursive -n --iterations -d --delay --order'
)
_init_completion || return
+ if __contains_word "$prev" ${OPTS[ARG]}; then
+ case $prev in
+ --machine|-M)
+ comps=$( __get_machines )
+ ;;
+ --recursive)
+ comps='yes no'
+ ;;
+ --order)
+ comps='path tasks cpu memory io'
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
}