summary refs log tree commit diff
path: root/Completion/BSD
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/BSD')
-rw-r--r--Completion/BSD/Type/_bsd_disks26
-rw-r--r--Completion/BSD/Type/_fbsd_device_types31
2 files changed, 57 insertions, 0 deletions
diff --git a/Completion/BSD/Type/_bsd_disks b/Completion/BSD/Type/_bsd_disks
new file mode 100644
index 000000000..986d36e45
--- /dev/null
+++ b/Completion/BSD/Type/_bsd_disks
@@ -0,0 +1,26 @@
+#autoload
+# disk device names on BSDs
+local -a disks
+
+case $OSTYPE in
+  freebsd*)
+    disks=( ${${(M)${(f)"$(geom disk list)"}\:#Geom name\:*}#*\: } )
+  ;;
+  dragonfly*)
+    disks=( $(sysctl -n kern.disks) )
+  ;;
+  openbsd*)
+    disks=( ${${(s.,.)"$(sysctl -n hw.disknames)"}%\:*} )
+  ;;
+  netbsd*)
+    disks=( $(sysctl -n hw.disknames) )
+  ;;
+esac
+
+if (( $#disks )); then
+  local expl
+  _wanted disk-devices expl 'disk device' compadd "$@" $disks
+  return
+fi
+
+return 1
diff --git a/Completion/BSD/Type/_fbsd_device_types b/Completion/BSD/Type/_fbsd_device_types
new file mode 100644
index 000000000..f1897f6a7
--- /dev/null
+++ b/Completion/BSD/Type/_fbsd_device_types
@@ -0,0 +1,31 @@
+#autoload
+#
+# device types on FreeBSD/DragonFly
+# (for commands using devstat_buildmatch(), such as iostat and vmstat)
+#
+local -a d i types
+
+d=( da sa printer proc worm cd scanner optical changer
+    comm array enclosure floppy)
+i=( IDE SCSI other )
+types=(
+  "($d)da[direct access devices]"
+  "($d)sa[sequential access devices]"
+  "($d)printer[printers]"
+  "($d)proc[processor devices]"
+  "($d)worm[write once read multiple devices]"
+  "($d)cd[CD devices]"
+  "($d)scanner[scanner devices]"
+  "($d)optical[optical memory devices]"
+  "($d)changer[medium changer devices]"
+  "($d)comm[communication devices]"
+  "($d)array[storage array devices]"
+  "($d)enclosure[enclosure services devices]"
+  "($d)floppy[floppy devices]"
+  "($i)IDE[Integrated Drive Electronics devices]"
+  "($i)SCSI[Small Computer System Interface devices]"
+  "($i)other[any other device interface]"
+  'pass[passthrough devices]'
+)
+
+_values -s , 'device type' $types