File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,26 @@ _kldload()
77 local cur prev words cword
88 _init_completion || return
99
10- local moddir=/modules/
11- [[ -d $moddir ]] || moddir=/boot/kernel/
10+ if [[ " $cur " == * /* ]]; then
11+ _filedir ko
12+ return
13+ fi
14+
15+ local moddirs modules i IFS=" ;"
16+ moddirs=($( kldconfig -r 2> /dev/null) )
17+ _comp_unlocal IFS
1218
1319 compopt -o filenames
14- COMPREPLY=($( compgen -f " $moddir$cur " ) )
15- COMPREPLY=(${COMPREPLY[@]# $moddir } )
20+ for i in " ${moddirs[@]} " ; do
21+ modules=($( compgen -f " $i /$cur " ) )
22+ modules=(${modules[@]# $i / } )
23+ COMPREPLY+=(" ${modules[@]} " )
24+ done
1625 COMPREPLY=(${COMPREPLY[@]% .ko} )
1726
27+ # also add dirs in current dir
28+ _filedir -d
29+
1830} &&
1931 complete -F _kldload kldload
2032
You can’t perform that action at this time.
0 commit comments