summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-04-03 03:00:44 +0200
committerKay Sievers <kay@vrfy.org>2014-04-04 08:24:22 -0400
commit51e430a5b053dde2abc4bbd5d702ff2b900f10c2 (patch)
treeee433a932197f2e923fa638d205ac3e4c4496294
parent085ebc1b222b4fc7329a03c8459fe5fb1844c802 (diff)
bash_completion: busctl - add support for --user mode
-rw-r--r--shell-completion/bash/busctl13
1 files changed, 10 insertions, 3 deletions
diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl
index 06d5d9383d..49520e48d2 100644
--- a/shell-completion/bash/busctl
+++ b/shell-completion/bash/busctl
@@ -31,12 +31,13 @@ __get_machines() {
}
__get_endpoints() {
+ local mode=$1
local a b
- busctl list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
+ busctl $mode list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
}
_busctl() {
- local i verb comps
+ local i verb comps mode
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-h --help --version --no-pager --no-legend --system --user
@@ -44,6 +45,12 @@ _busctl() {
[ARG]='-H --host -M --machine --address --match'
)
+ if __contains_word "--user" ${COMP_WORDS[*]}; then
+ mode=--user
+ else
+ mode=--system
+ fi
+
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--host|-H)
@@ -79,7 +86,7 @@ _busctl() {
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
comps=''
elif __contains_word "$verb" ${VERBS[ENDPOINT]}; then
- comps=$( __get_endpoints )
+ comps=$( __get_endpoints $mode)
fi
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )