# bash completion for FreeBSD package management tools     -*- shell-script -*-

[[ $OSTYPE == *freebsd* ]] || return 1

_pkg_delete()
{
    local cur prev words cword
    _init_completion || return

    local pkgdir=${PKG_DBDIR:-/var/db/pkg}/

    [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return 0

    COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
    COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )

    return 0
} &&
complete -F _pkg_delete -o dirnames pkg_delete pkg_info pkg_deinstall

# ex: ts=4 sw=4 et filetype=sh
