summaryrefslogtreecommitdiff
path: root/shell-completion/bash/systemd-cgtop
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-21 14:55:48 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-21 14:55:48 +0200
commit213634e47674a3e5eb64a61cdab22c71df7a8894 (patch)
tree8cc2f7268a299eebee0d5225824343c74aaa3e07 /shell-completion/bash/systemd-cgtop
parent8c710f3ce64110a4cfe977116c55bd87777e641c (diff)
parent96a6426f30dc9bf3c4dd1f61548c334fa12034df (diff)
Merge pull request #1314 from evverx/cgtop-machine
cgtop: add -M/--machine
Diffstat (limited to 'shell-completion/bash/systemd-cgtop')
-rw-r--r--shell-completion/bash/systemd-cgtop17
1 files changed, 16 insertions, 1 deletions
diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop
index 50464990ab..eefb8fc5c4 100644
--- a/shell-completion/bash/systemd-cgtop
+++ b/shell-completion/bash/systemd-cgtop
@@ -24,17 +24,32 @@ __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'
+ [ARG]='--cpu --depth -M --machine'
)
_init_completion || return
+ if __contains_word "$prev" ${OPTS[ARG]}; then
+ case $prev in
+ --machine|-M)
+ comps=$( __get_machines )
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
}