
_doggo() {
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="--version -h --help -q --query -t --type -n --nameserver -c --class -x --reverse --any -A --authoritative --trace --strategy --ndots --search -T --timeout -4 --ipv4 -6 --ipv6 --http3 --tls-hostname --skip-hostname-verification -b --source --aa --ad --cd --rd --z --do --nsid --cookie --padding --ede --ecs --bufsize -J --json --short --color --debug --time --gp-from --gp-limit --config"

    case "${prev}" in
        --config)
            COMPREPLY=( $(compgen -f -- ${cur}) )
            return 0
            ;;
        -t|--type)
            COMPREPLY=( $(compgen -W "A AAAA CAA CNAME HINFO HTTPS MX NS PTR SOA SRV SVCB TXT" -- ${cur}) )
            return 0
            ;;
        -c|--class)
            COMPREPLY=( $(compgen -W "IN CH HS" -- ${cur}) )
            return 0
            ;;
        -n|--nameserver)
            COMPREPLY=( $(compgen -A hostname -- ${cur}) )
            return 0
            ;;
        --strategy)
            COMPREPLY=( $(compgen -W "all random first internal" -- ${cur}) )
            return 0
            ;;
        -T|--timeout|--ndots|--ecs|--bufsize|-b|--source|--gp-from|--gp-limit)
            # Value-taking flags with no sensible static completion; suppress
            # the fallback hostname completion below.
            COMPREPLY=()
            return 0
            ;;
    esac

    if [[ ${cur} == -* ]]; then
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
    else
        COMPREPLY=( $(compgen -A hostname -- ${cur}) )
    fi
}

complete -F _doggo doggo

