summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-04-04 09:39:10 +0200
committerGitHub <noreply@github.com>2018-04-04 09:39:10 +0200
commit29ac24d2f4c35fe121e74676f4e19eafae36bbed (patch)
treed34b891928fab9babd01d0f4b0e10aa19bef3d39
parent63554ed9073fd7e2cb95204c39e14ff7d9141d9b (diff)
parent7f9c3ecad840fe8584ad4d350eefb67fe43869e7 (diff)
downloadsystemd-29ac24d2f4c35fe121e74676f4e19eafae36bbed.tar.gz
Merge pull request #8624 from yuwata/fix-8371
bash-completion: fixes for busctl
-rw-r--r--shell-completion/bash/busctl15
1 files changed, 8 insertions, 7 deletions
diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl
index d077675a32..c357c25bc3 100644
--- a/shell-completion/bash/busctl
+++ b/shell-completion/bash/busctl
@@ -48,7 +48,7 @@ __get_interfaces() {
local mode=$1
local busname=$2
local path=$3
- local a b
+ local a b c
busctl $mode introspect --list --no-legend --no-pager $busname $path | { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; };
}
@@ -58,8 +58,9 @@ __get_members() {
local path=$3
local interface=$4
local type=$5
- local a b
- busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c; do [[ "$b" == "$type" ]] && echo " $a"; done; };
+ local flags=$6
+ local a b c d e
+ busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; };
}
__get_signature() {
@@ -68,12 +69,12 @@ __get_signature() {
local path=$3
local interface=$4
local member=$5
- local a b
- busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" ]] && echo " \"$c\""; done; };
+ local a b c d
+ busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; };
}
_busctl() {
- local i verb comps mode
+ local i n 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
@@ -176,7 +177,7 @@ _busctl() {
elif [[ $n -eq 3 ]] ; then
comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]})
elif [[ $n -eq 4 ]] ; then
- comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property)
+ comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property writable)
elif [[ $n -eq 5 ]] ; then
comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]})
else