# this was auto-generated by OpenSC/doc/tools/Makefile.am
_pkcs15_tool()
{
    COMPREPLY=()
    local cur prev split=false
    _get_comp_words_by_ref -n : cur prev

    if type _init_completion &>/dev/null; then
        _init_completion -s && split=true
    else
        _split_longopt && split=true
    fi

    opts="		--aid --auth-id --change-pin --clear-cache --dump --list-applications --list-certificates --list-data-objects --list-info --list-keys --list-pins --list-public-keys --list-secret-keys --new-pin --no-cache --output --pin --puk --raw --read-certificate --read-data-object --read-public-key --read-ssh-key --reader --rfc4716 --short --test-session-pin --test-update --unblock-pin --update --use-pinpad --verbose --verify-pin --version --wait -C -D -R -T -U -a -c -k -o -s -u -v -w "

    if [ ${COMP_CWORD} -eq 1 ]; then
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
        return 0
    fi

    case "${prev}" in
        		!*)
            _filedir so
            return 0
            ;;
        		--output|-o)
            _filedir
            return 0
            ;;
        		--new-pin|--pin|--puk|--password)
            COMPREPLY=( $( compgen -W "$(printenv | cut -d = -f 1 | xargs printf 'env:%s ')" -- $cur ) )
            __ltrim_colon_completions "$cur"
            return 0
            ;;
        		--aid|--auth-id|--new-pin|--output|--pin|--puk|--read-certificate|--read-data-object|--read-public-key|--read-ssh-key|--reader|-R|-a|-o)
            return 0
            ;;
        *)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
    esac

    $split && return 0

    if [[ "$cur" == -* ]]; then
        _longopt $1
        return
    fi

    _filedir
}
complete -F _pkcs15_tool pkcs15-tool


# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh
