summaryrefslogtreecommitdiff
path: root/shell/completions/gnome-control-center.in
blob: 37e68303178a6682efbea75bf0d5a7471a96a5cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#
# gnome-control-center tab completion for bash.

_gnome_control_center()
{
	local cur prev command_list i v

	cur=${COMP_WORDS[COMP_CWORD]}
	prev=${COMP_WORDS[COMP_CWORD-1]}

	case "$prev" in
	-o|--overview)
		command_list=""
		;;
	*)
		if [ $prev = "gnome-control-center" ] ; then
			command_list="--overview --verbose --version"
			command_list="$command_list @PANELS@"
		elif [ $prev = "--verbose" ]; then
			command_list="@PANELS@"
		fi

		# FIXME
		# Add the argvs for some of the panels that
		# support it, such as network
		for i in --overview --version @PANELS@; do
			if [ $i = $prev ]; then
				command_list=""
			fi
		done
		;;
	esac

	for i in $command_list; do
		if [ -z "${i/$cur*}" ]; then
			COMPREPLY=( ${COMPREPLY[@]} $i )
		fi
	done
}

# load the completion
complete -F _gnome_control_center gnome-control-center