]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash-completion: busctl: suggests only writable properties for set-property
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 30 Mar 2018 08:06:50 +0000 (17:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 30 Mar 2018 08:06:50 +0000 (17:06 +0900)
shell-completion/bash/busctl

index d077675a326a339b9d618a9ab6605d43432fa482..cfa4d4fa83143b3cfa50ef82e15f847351965437 100644 (file)
@@ -58,8 +58,9 @@ __get_members() {
         local path=$3
         local interface=$4
         local type=$5
+        local flags=$6
         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; };
+        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() {
@@ -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