gnome-control-center/shell/completions/gnome-control-center.in
Michael Biebl 385cd85708 completion: Drop shebang
No other bash completion file has a shebang (as said, those
are meant to be sourced) and Debian's automated test tool
lintian keeps flagging Control Center's completion, so it
seemed reasonable to fix that for good upstream.

Those completion files are meant to be sourced, not executed directly.

https://bugzilla.gnome.org/show_bug.cgi?id=756582
2018-01-21 11:35:49 -02:00

54 lines
1.1 KiB
Text

# 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
for i in --overview --version @PANELS@; do
if [ $i = $prev ]; then
case $i in
keyboard)
command_list="shortcuts typing"
;;
network)
# FIXME
# The first 3 commands need an object path like
# /org/freedesktop/NetworkManager/Devices/1
command_list="connect-3g connect-8021x-wifi show-device connect-hidden-wifi create-wifi"
;;
sound)
command_list="applications effects hardware input outputs"
;;
*)
command_list=""
;;
esac
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