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\n--version\nhelp \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nreset-recursively \nwritable \nmonitor \ndescribe '
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\nreset-recursively\nwritable\nmonitor'
37 list-keys|list-children|list-recursively|reset-recursively)
38 choices="$(gsettings $schemadir list-schemas 2> /dev/null)"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
41 COMPREPLY=($(compgen -W "--print-paths" -- ${COMP_WORDS[${COMP_CWORD}]}))
45 get|range|set|reset|writable|monitor|describe)
46 choices="$(gsettings $schemadir list-schemas 2> /dev/null | sed -e 's.$. .')"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
52 case "${COMP_WORDS[$(($coffset+1))]}" in
54 choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')"
57 get|range|reset|writable|monitor|describe)
58 choices="$(gsettings $schemadir list-keys ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null)"
64 case "${COMP_WORDS[$(($coffset+2))]}" in
66 range=($(gsettings $schemadir range ${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev/null))
83 COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
86 ####################################################################################################
88 complete -o nospace -F __gsettings gsettings