_fido2luks() {
    local i cur prev opts cmds
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    cmd=""
    opts=""

    for i in ${COMP_WORDS[@]}
    do
        case "${i}" in
            fido2luks)
                cmd="fido2luks"
                ;;
            
            add)
                cmd+="__add"
                ;;
            add-key)
                cmd+="__add__key"
                ;;
            completions)
                cmd+="__completions"
                ;;
            connected)
                cmd+="__connected"
                ;;
            credential)
                cmd+="__credential"
                ;;
            gc)
                cmd+="__gc"
                ;;
            help)
                cmd+="__help"
                ;;
            list)
                cmd+="__list"
                ;;
            open)
                cmd+="__open"
                ;;
            open-token)
                cmd+="__open__token"
                ;;
            print-secret)
                cmd+="__print__secret"
                ;;
            remove)
                cmd+="__remove"
                ;;
            replace-key)
                cmd+="__replace__key"
                ;;
            token)
                cmd+="__token"
                ;;
            *)
                ;;
        esac
    done

    case "${cmd}" in
        fido2luks)
            opts=" -i -h -V  --interactive --help --version   print-secret add-key replace-key open open-token credential connected token completions help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        
        fido2luks__add__key)
            opts=" -P -e -t -f -h -V -d  --pin --exclusive --token --fido-device --help --version --slot --pin-source --await-dev --salt --keyfile --kdf-time  <device> <credential-id> <password-helper> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --slot)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pin-source)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --await-dev)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --salt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --keyfile)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -d)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --kdf-time)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__completions)
            opts=" -h -V  --help --version  <shell> <out-dir> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__connected)
            opts=" -h -V  --help --version  "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__credential)
            opts=" -P -h -V  --pin --help --version --pin-source --await-dev  <name> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --pin-source)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --await-dev)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__help)
            opts=" -h -V  --help --version  "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__open)
            opts=" -P -h -V -r  --pin --allow-discards --help --version --slot --pin-source --await-dev --salt --max-retries  <device> <name> <credential-id> <password-helper> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --slot)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pin-source)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --await-dev)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --salt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-retries)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -r)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__open__token)
            opts=" -P -h -V -r  --pin --allow-discards --help --version --slot --pin-source --await-dev --salt --max-retries  <device> <name> <password-helper> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --slot)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pin-source)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --await-dev)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --salt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-retries)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -r)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__print__secret)
            opts=" -b -P -h -V  --bin --pin --help --version --pin-source --await-dev --salt  <credential-id> <password-helper> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --pin-source)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --await-dev)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --salt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__replace__key)
            opts=" -P -a -t -f -h -V -d  --pin --add-password --token --fido-device --help --version --slot --pin-source --await-dev --salt --keyfile --kdf-time  <device> <credential-id> <password-helper> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --slot)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pin-source)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --await-dev)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --salt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --keyfile)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -d)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --kdf-time)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__token)
            opts=" -h -V  --help --version   list add remove gc help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__token__add)
            opts=" -h -V  --help --version --slot  <device> <credential-id> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --slot)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__token__gc)
            opts=" -h -V  --help --version  <device> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__token__help)
            opts=" -h -V  --help --version  "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__token__list)
            opts=" -h -V  --csv --help --version  <device> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        fido2luks__token__remove)
            opts=" -h -V  --help --version --token  <device> <credential-id> "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --token)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
    esac
}

complete -F _fido2luks -o bashdefault -o default fido2luks
