# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
# ex: ts=8 sw=8 noet filetype=sh
#
# bash completion for vncviewer

have vncviewer &&
_vncviewer()
{
	local cur prev

	COMPREPLY=()
	cur=`_get_cword`
	prev=${COMP_WORDS[COMP_CWORD-1]}

	case $prev in
		-passwd)
			_filedir
			return 0
			;;
		-encodings)
			COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib \
				corre rre raw' -- $cur ) )
			return 0
			;;
		-via)
			_known_hosts
			return 0
			;;
	esac


	if [[ "$cur" == -* ]]; then
		COMPREPLY=( $( compgen -W '-help -listen -via -shared -noshared\
			-viewonly -fullscreen -noraiseonbeep -passwd -encodings\
			-bgr233 -owncmap -truecolour -truecolor -depth \
			-compresslevel -quality -nojpeg -nocursorshape \
			-x11cursor' -- $cur ) )
	else
		_known_hosts
	fi
} &&
complete -F _vncviewer vncviewer
