# dist-installer-cli(8) completion                           -*- shell-script -*-

## Copyright (C) 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

_dist_installer_cli()
{
    local cur prev words cword
    _init_completion -s || return
    ## prepare for bash-completion > 2.11
    #local cur prev words cword split comp_args
    #_comp_initialize -s -- "$@" || return

    case $prev in
        --guest-version | --socks-proxy | --onion | --non-interactive | \
            --no-import | --no-boot | --redownload | \
            --destroy-existing-guest | --dev | --ci | --dry-run | \
            --getopt | --no-show-errors | --allow-errors | --testers | \
            --virtualbox-only | --oracle-repo | --version | --help )
            return
            ;;
        --directory-prefix )
            _filedir -d
            return
            ;;
        --guest )
            COMPREPLY=($(compgen -W "whonix kicksecure" -- "$cur"))
            return
            ;;
        --interface )
            COMPREPLY=($(compgen -W "lxqt cli" -- "$cur"))
            return
            ;;
        --hypervisor )
            COMPREPLY=($(compgen -W "virtualbox kvm" -- "$cur"))
            return
            ;;
        --log-level )
            COMPREPLY=($(compgen -W "debug info notice warn error" -- "$cur"))
            return
            ;;
        --import-only )
            COMPREPLY=($(compgen -W "gateway workstation both" -- "$cur"))
            return
            ;;
        --mirror )
            COMPREPLY=($(compgen -W "0 1 2 3 4 5" -- "$cur"))
            return
            ;;
    esac

    $split && return

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
    fi

} &&
    complete -F _dist_installer_cli dist-installer-cli \
                kicksecure-cli-installer-cli kicksecure-lxqt-installer-cli \
                whonix-cli-installer-cli whonix-lxqt-installer-cli \
                virtualbox-installer-cli

# ex: filetype=sh
