# The following command was used to generate this script with click==8.1.3:
# _TMT_COMPLETE=bash_source tmt
# https://click.palletsprojects.com/en/8.1.x/shell-completion/

_tmt_completion() {
    local IFS=$'\n'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _TMT_COMPLETE=bash_complete $1)

    for completion in $response; do
        IFS=',' read type value <<< "$completion"

        if [[ $type == 'dir' ]]; then
            COMPREPLY=()
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            COMPREPLY=()
            compopt -o default
        elif [[ $type == 'plain' ]]; then
            COMPREPLY+=($value)
        fi
    done

    return 0
}

_tmt_completion_setup() {
    complete -o nosort -F _tmt_completion tmt
}

_tmt_completion_setup;
