# Bash/ZSH completion for t2caplist

_t2caplist() {
    #compdef t2caplist
    if type compdef &> /dev/null; then
        if [[ "${words[CURRENT]}" == -* ]]; then
            _arguments --
        else
            _files
        fi
    else
        local cur prev words cword
        _init_completion || return
        if [[ "$cur" == -* ]]; then
            COMPREPLY=($(compgen -W "$(_parse_help "$T2HOME/scripts/t2caplist")" -- "$cur"))
        else
            _filedir
        fi
    fi
}

if type compdef &> /dev/null; then
    compdef _t2caplist t2caplist
else
    complete -F _t2caplist t2caplist
fi
