docs: Add GIOModuleScope and GIOModuleScopeFlags
[glib.git] / gio / gsettings-bash-completion.sh
blobf695afb13a8b62247c371c26feca6c374c227e77
2 # Check for bash
3 [ -z "$BASH_VERSION" ] && return
5 ####################################################################################################
7 __gsettings() {
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]}")
14 coffset=2
15 else
16 coffset=0
18 else
19 coffset=0
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
29 --schemadir)
30 COMPREPLY=($(compgen -o dirnames -- ${COMP_WORDS[${COMP_CWORD}]}))
31 return 0
34 help)
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.$.:/.')"
44 esac
48 case "${COMP_WORDS[$(($coffset+1))]}" in
49 set)
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)"
56 esac
60 case "${COMP_WORDS[$(($coffset+2))]}" in
61 set)
62 range=($(gsettings $schemadir range ${COMP_WORDS[$(($coffset+2))]} ${COMP_WORDS[$(($coffset+3))]} 2> /dev/null))
63 case "${range[0]}" in
64 enum)
65 unset range[0]
68 unset range
70 esac
71 local IFS=$'\n'
72 choices="${range[*]}"
74 esac
76 esac
78 local IFS=$'\n'
79 COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
82 ####################################################################################################
84 complete -o nospace -F __gsettings gsettings