# bash completion for ncftp

have ncftp &&
_ncftp()
{
    local cur

    COMPREPLY=()
    _get_comp_words_by_ref cur

    if [[ $COMP_CWORD -eq 1 && -f ~/.ncftp/bookmarks ]]; then
        COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
            ~/.ncftp/bookmarks )' -- "$cur" ) )
    fi

    return 0
} &&
complete -F _ncftp -o default ncftp

# 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
