Trivial: fix a typo
[platform/upstream/glib.git] / gio / gsettings-bash-completion.sh
1
2 # Check for bash
3 [ -z "$BASH_VERSION" ] && return
4
5 ####################################################################################################
6
7 __gsettings() {
8   local choices
9
10   case "${COMP_CWORD}" in
11     1)
12       choices=$'help \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nwritable \nmonitor'
13       ;;
14
15     2)
16       case "${COMP_WORDS[1]}" in
17         help)
18           choices=$'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nwritable\nmonitor'
19           ;;
20         list-keys|list-children|list-recursively)
21           choices="$(gsettings list-schemas)"$'\n'"$(gsettings list-relocatable-schemas | sed -e 's.$.:/.')"
22           ;;
23
24         get|range|set|reset|writable|monitor)
25           choices="$(gsettings list-schemas | sed -e 's.$. .')"$'\n'"$(gsettings list-relocatable-schemas | sed -e 's.$.:/.')"
26           ;;
27       esac
28       ;;
29
30     3)
31       case "${COMP_WORDS[1]}" in
32         set)
33           choices="$(gsettings list-keys ${COMP_WORDS[2]} 2> /dev/null | sed -e 's.$. .')"
34           ;;
35
36         get|range|reset|writable|monitor)
37           choices="$(gsettings list-keys ${COMP_WORDS[2]} 2> /dev/null)"
38           ;;
39       esac
40       ;;
41
42     4)
43       case "${COMP_WORDS[1]}" in
44         set)
45           range=($(gsettings range ${COMP_WORDS[2]} ${COMP_WORDS[3]} 2> /dev/null))
46           case "${range[0]}" in
47             enum)
48               unset range[0]
49              ;;
50             *)
51               unset range
52              ;;
53           esac
54           local IFS=$'\n'
55           choices="${range[*]}"
56           ;;
57       esac
58       ;;
59   esac
60
61   local IFS=$'\n'
62   COMPREPLY=($(compgen -W "${choices}" "${COMP_WORDS[$COMP_CWORD]}"))
63 }
64
65 ####################################################################################################
66
67 complete -o nospace -F __gsettings gsettings