# FreeBSD kldunload completion                             -*- shell-script -*-

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

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

    COMPREPLY=( $( kldstat | command sed -ne \
        "s/^.*[[:blank:]]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
} &&
complete -F _kldunload kldunload

# ex: filetype=sh
