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

    if [[ $COMP_CWORD -eq 1 ]] ; then
        COMPREPLY=( $( compgen -W "ci1 ci3 ci4 ci% % ppc" -- $cur ) )
    else
	if [ $COMP_CWORD -gt 2 ] && [[ "$prev" == "cat" ]] ; then
	    COMPREPLY=( $( compgen -o filenames -f -- $cur ) )
	elif [ $COMP_CWORD -gt 2 ] && [[ "$prev" == "cvsup-files" ]] ; then
	    COMPREPLY=( $( compgen -o filenames -f -- $cur ) )
	elif [ $COMP_CWORD -gt 2 ] && [[ "$prev" == "webinterfaces" ]] ; then
	    COMPREPLY=( $( compgen -W "stop start status" -f -- $cur ) )
	else
	    COMPREPLY=( $( compgen -W "aconn apache-reload apache-start apache-status apache-stop cat cvs cvsup cvsup-files svn svnup svnup-files svn-status df egrep exec grep hits-density kill-daemons lexec ls mysql ps slave-status slave-behind slave-pos uptime wc webinterfaces unit-tests update-news url-domain" -- $cur ) )
	fi
    fi
}
complete -F _clus clus
complete -F _clus partner-clus

