about summary refs log tree commit diff
path: root/Completion/BSD
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2019-06-03 22:27:27 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2019-06-03 22:33:10 +0900
commit1d37624ad6ada222f0ae69816a034dd342406b3e (patch)
tree6c6cff34e2e6f65a6e216843a547c0691bf04843 /Completion/BSD
parent4b85edface379a3575273a2b712d80bd9420d4c9 (diff)
downloadzsh-1d37624ad6ada222f0ae69816a034dd342406b3e.tar.gz
zsh-1d37624ad6ada222f0ae69816a034dd342406b3e.tar.xz
zsh-1d37624ad6ada222f0ae69816a034dd342406b3e.zip
44389: update _iostat and _vmstat for BSD
common parts are separated into _bsd_disks and _fbsd_device_types
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