function __wlopm_completion ()
{
    case "${COMP_WORDS[-2]}" in
	"--on"|"--off"|"--toggle")
	    OPTS="$(wlopm | cut -d' ' -f1 | tr '\n' ' ')"
	    ;;

	*)
	    OPTS="-h --help -j --json -v --version --on --off --toggle"
	    ;;
    esac
    COMPREPLY=($(compgen -W "${OPTS}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
}
complete -F __wlopm_completion wlopm
