1
2_clap_complete_my_app() {
3    local IFS=$'/013'
4    local SUPPRESS_SPACE=0
5    if compopt +o nospace 2> /dev/null; then
6        SUPPRESS_SPACE=1
7    fi
8    if [[ ${SUPPRESS_SPACE} == 1 ]]; then
9        SPACE_ARG="--no-space"
10    else
11        SPACE_ARG="--space"
12    fi
13    COMPREPLY=( $("my-app" complete --index ${COMP_CWORD} --type ${COMP_TYPE} ${SPACE_ARG} --ifs="$IFS" -- "${COMP_WORDS[@]}") )
14    if [[ $? != 0 ]]; then
15        unset COMPREPLY
16    elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
17        compopt -o nospace
18    fi
19}
20complete -o nospace -o bashdefault -F _clap_complete_my_app my-app
21
22