# Bash/ZSH completion for t2doc

_t2doc() {
    #compdef t2doc
    local plugins=(tawk)
    for i in "$T2HOME"/*; do
        local b=$(basename "$i")
        if [ -d "$i" ] && [ "$b" != "doc" ] && [ "$b" != "t2PSkel" ] && [ "$b" != "utils" ]; then
            plugins+=($b)
        fi
    done
    if type compdef &> /dev/null; then
        compadd "${plugins[@]}"
    else
        local cur="${COMP_WORDS[COMP_CWORD]}"
        COMPREPLY=($(compgen -W "${plugins[*]}" -- "$cur"))
    fi
}

if type compdef &> /dev/null; then
    compdef _t2doc t2doc
else
    complete -F _t2doc t2doc
fi
