summaryrefslogtreecommitdiff
path: root/shell/completions
diff options
context:
space:
mode:
authorJeremy Bicha <jbicha@ubuntu.com>2013-01-17 01:20:28 -0500
committerBastien Nocera <hadess@hadess.net>2013-01-17 14:14:07 +0100
commitda2a8bd62efad8e9db757dd48d5f2ed87e5848d2 (patch)
treef998e434a425e5e90ad8f0fdd6949de158ae6db4 /shell/completions
parent04f993a66a5695f1e73e8086c29e565cec82fb7d (diff)
downloadgnome-control-center-da2a8bd62efad8e9db757dd48d5f2ed87e5848d2.tar.gz
shell: Rename bash completion file so that it's recognized
Bash completion needs the file to be named gnome-control-center https://bugzilla.gnome.org/show_bug.cgi?id=691924
Diffstat (limited to 'shell/completions')
-rw-r--r--shell/completions/gnome-control-center.in43
1 files changed, 43 insertions, 0 deletions
diff --git a/shell/completions/gnome-control-center.in b/shell/completions/gnome-control-center.in
new file mode 100644
index 000000000..37e683031
--- /dev/null
+++ b/shell/completions/gnome-control-center.in
@@ -0,0 +1,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