3 [ -z "$BASH_VERSION" ] && return
5 ####################################################################################################
8 local choices coffset schemadir
10 if [ ${COMP_CWORD} -gt 2 ]; then
11 if [ ${COMP_WORDS[1]} = --schemadir ]; then
12 # this complexity is needed to perform correct tilde expansion
13 schemadir
=$
(eval "echo --schemadir ${COMP_WORDS[2]}")
22 case "$((${COMP_CWORD}-$coffset))" in
24 choices
=$
'--schemadir\nhelp \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nwritable \nmonitor'
28 case "${COMP_WORDS[$(($coffset+1))]}" in
30 COMPREPLY
=($
(compgen
-o dirnames
-- ${COMP_WORDS[${COMP_CWORD}]}))
35 choices
=$
'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nwritable\nmonitor'
37 list-keys|list-children|list-recursively
)
38 choices
="$(gsettings $schemadir list-schemas)"$
'\n'"$(gsettings $schemadir list-relocatable-schemas | sed -e 's.$.:/.')"
41 get|range|
set|
reset|writable|monitor
)
42 choices
="$(gsettings $schemadir list-schemas | sed -e 's.$. .')"$
'\n'"$(gsettings $schemadir list-relocatable-schemas | sed -e 's.$.:/.')"
48 case "${COMP_WORDS[$(($coffset+1))]}" in
50 choices
="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')"
53 get|range|
reset|writable|monitor
)
54 choices
="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null)"
60 case "${COMP_WORDS[$(($coffset+2))]}" in
62 range
=($
(gsettings
$schemadir range
${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev
/null
))
79 COMPREPLY
=($
(compgen
-W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
82 ####################################################################################################
84 complete
-o nospace
-F __gsettings gsettings