_rht_vmctl_module()
{
    local cur prev CMDS="view start stop reset status save poweroff fullreset"

    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case ${prev} in
	'-h'|'--help')
	    return 0
	    ;;
	fullreset|poweroff|reset|save|start|status|stop|view)
	    [[ -r /etc/rht ]] && . /etc/rht
	    [[ -n "${RHT_VM0}" ]] && myvms="${RHT_VM0} ${RHT_VMS}" || myvms="${RHT_VMS}"
	    COMPREPLY=( $(compgen -W "${myvms} all" -- $cur) )
	    return 0
            ;;
	*rht-vmctl)
#	    COMPREPLY=( $(compgen -W "--help ${CMDS}" -- $cur) )
	    COMPREPLY=( $(compgen -W "${CMDS}" -- $cur) )
	    return 0
	    ;;
    esac
}
complete -F _rht_vmctl_module rht-vmctl
