Add completions for FreeBSD's kldunload

Lists currently loaded kernel modules as valid completions, and obtains
a description via the newly minted `__fish_whatis` if available.
This commit is contained in:
Mahmoud Al-Qudsi 2018-06-27 14:12:52 -05:00
parent 948b9d2ab8
commit 121c70cf39
2 changed files with 13 additions and 0 deletions

View File

@ -69,6 +69,7 @@ This section is for changes merged to the `major` branch that are not also merge
- `j` (autojump #4344)
- `jhipster` (#4472)
- `kldload`
- `kldunload`
- `meson`
- `ngrok` (#4642)
- `optipng`

View File

@ -0,0 +1,12 @@
function __fish_list_loaded_klds
set -l klds (kldstat | string match -r '\b\S+.ko$')
for kld in $klds
if set -l description (__fish_whatis (string replace '.ko' '' -- $kld) "kernel module")
printf '%s\t%s\n' $kld $description
else
printf '%s\n' $kld
end
end
end
complete -c kldunload -xa '(__fish_list_loaded_klds)'