2010-06-27 22:00:20 +02:00
|
|
|
|
|
|
|
# Check for bash
|
|
|
|
[ -z "$BASH_VERSION" ] && return
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
|
|
|
__gsettings() {
|
2010-10-03 08:40:48 +02:00
|
|
|
local choices
|
|
|
|
|
|
|
|
case "${COMP_CWORD}" in
|
|
|
|
1)
|
2010-10-30 06:00:06 +02:00
|
|
|
choices=$'help \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nwritable \nmonitor'
|
2010-10-03 08:40:48 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
2)
|
|
|
|
case "${COMP_WORDS[1]}" in
|
|
|
|
help)
|
2010-10-30 06:00:06 +02:00
|
|
|
choices=$'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nwritable\nmonitor'
|
2010-10-03 08:40:48 +02:00
|
|
|
;;
|
2010-10-30 06:00:06 +02:00
|
|
|
list-keys|list-children|list-recursively)
|
2010-10-03 08:40:48 +02:00
|
|
|
choices="$(gsettings list-schemas)"$'\n'"$(gsettings list-relocatable-schemas | sed -e 's.$.:/.')"
|
|
|
|
;;
|
|
|
|
|
2010-10-04 09:41:03 +02:00
|
|
|
get|range|set|reset|writable|monitor)
|
2010-10-03 08:40:48 +02:00
|
|
|
choices="$(gsettings list-schemas | sed -e 's.$. .')"$'\n'"$(gsettings list-relocatable-schemas | sed -e 's.$.:/.')"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
3)
|
|
|
|
case "${COMP_WORDS[1]}" in
|
|
|
|
set)
|
|
|
|
choices="$(gsettings list-keys ${COMP_WORDS[2]} 2> /dev/null | sed -e 's.$. .')"
|
|
|
|
;;
|
|
|
|
|
2010-10-04 09:41:03 +02:00
|
|
|
get|range|reset|writable|monitor)
|
2010-10-03 08:40:48 +02:00
|
|
|
choices="$(gsettings list-keys ${COMP_WORDS[2]} 2> /dev/null)"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
local IFS=$'\n'
|
|
|
|
COMPREPLY=($(compgen -W "${choices}" "${COMP_WORDS[$COMP_CWORD]}"))
|
2010-06-27 22:00:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
|
|
|
complete -o nospace -F __gsettings gsettings
|