about summary refs log tree commit diff
path: root/Completion/BSD/Command
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:21:07 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:21:07 +0000
commit934fe9422951e9166c9877a5ce4e97fac4ab8e94 (patch)
tree1074a7fcf459e8b6b3c8dbb382cfc04c1257af95 /Completion/BSD/Command
parent6584833eff28527a6b5f73a19cd85d0056bd3965 (diff)
downloadzsh-934fe9422951e9166c9877a5ce4e97fac4ab8e94.tar.gz
zsh-934fe9422951e9166c9877a5ce4e97fac4ab8e94.tar.xz
zsh-934fe9422951e9166c9877a5ce4e97fac4ab8e94.zip
moved from Completion/Bsd/_kld
Diffstat (limited to 'Completion/BSD/Command')
-rw-r--r--Completion/BSD/Command/_kld41
1 files changed, 41 insertions, 0 deletions
diff --git a/Completion/BSD/Command/_kld b/Completion/BSD/Command/_kld
new file mode 100644
index 000000000..eefc8bf61
--- /dev/null
+++ b/Completion/BSD/Command/_kld
@@ -0,0 +1,41 @@
+#compdef kldload kldunload
+
+(( $+functions[_kld_module] )) ||
+_kld_module() {
+  local ret=1
+
+  compadd "$@" - /boot/kernel/*.ko(:t) /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 "$service" 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
+}
+
+_kld "$@"