39 lines
797 B
Plaintext
Raw Normal View History

# bash completion for FreeBSD kernel module commands
[ $UNAME = FreeBSD ] || return
_kldload()
{
local cur prev words cword
_init_completion || return
local moddir=/modules/
2009-10-04 19:42:50 +02:00
[ -d $moddir ] || moddir=/boot/kernel/
_compopt_o_filenames
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} )
2009-10-04 19:42:50 +02:00
return 0
2011-04-04 22:14:39 +03:00
} &&
complete -F _kldload kldload
_kldunload()
{
local cur prev words cword
_init_completion || return
2009-11-03 22:04:46 +02:00
COMPREPLY=( $( kldstat | \
sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
2011-04-04 22:14:39 +03:00
} &&
complete -F _kldunload kldunload
# Local variables:
# mode: shell-script
2009-10-04 19:42:50 +02:00
# sh-basic-offset: 4
# sh-indent-comment: t
2009-10-04 19:42:50 +02:00
# indent-tabs-mode: nil
# End:
2009-10-04 19:42:50 +02:00
# ex: ts=4 sw=4 et filetype=sh