summary refs log tree commit diff
path: root/Completion/Bsd/_kld
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-20 09:45:04 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-20 09:45:04 +0000
commit4debe47da511d78f9bee5d26926308e640b7bc9f (patch)
tree7064956c52f8b3db7aca03e5d906405a12e551bf /Completion/Bsd/_kld
parentc9bedcd98923cd9890bd5d92ec5b0ada57bccc31 (diff)
downloadzsh-4debe47da511d78f9bee5d26926308e640b7bc9f.tar.gz
zsh-4debe47da511d78f9bee5d26926308e640b7bc9f.tar.xz
zsh-4debe47da511d78f9bee5d26926308e640b7bc9f.zip
new completions for FreeBSD commands (10861)
Diffstat (limited to 'Completion/Bsd/_kld')
-rw-r--r--Completion/Bsd/_kld41
1 files changed, 41 insertions, 0 deletions
diff --git a/Completion/Bsd/_kld b/Completion/Bsd/_kld
new file mode 100644
index 000000000..065aa0c98
--- /dev/null
+++ b/Completion/Bsd/_kld
@@ -0,0 +1,41 @@
+#compdef kldload kldunload
+
+(( $+functions[_kld_module] )) ||
+_kld_module() {
+  local ret=1
+
+  compadd "$@" - /modules/*.ko(:t) && ret=0
+  _files "$@" -g \*.ko && ret=0
+
+  return ret
+}
+
+(( $+functions[_kld_unload] )) ||
+_kld_unload() {
+  compadd "$@" - $( /sbin/kldstat | awk '($1 ~ /^[0-9]/) { print $5 }' )
+}
+
+(( $+functions[_kld_unload_id] )) ||
+_kld_unload_id() {
+  compadd "$@" - $( /sbin/kldstat | awk '($1 ~ /^[0-9]/) { print $1 }' )
+}
+
+_kld() {
+  case "${words[1]:t}" in
+  kldload)
+    _arguments -s \
+        '-v[be verbose]' \
+        '*:module to load:_kld_module'
+    ;;
+
+  kldunload)
+    _arguments -s \
+        '-v[be verbose]' \
+        '(-n)-i:module id to unload:_kld_unload_id' \
+        '(-i)-n:module to unload:_kld_unload' \
+        '*:module to unload:_kld_unload'
+    ;;
+  esac
+}
+
+[[ -o kshautoload ]] || _kld "$@"