summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command
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/Unix/Command
parent4b85edface379a3575273a2b712d80bd9420d4c9 (diff)
downloadzsh-1d37624ad6ada222f0ae69816a034dd342406b3e.tar.gz
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/Unix/Command')
-rw-r--r--Completion/Unix/Command/_iostat48
-rw-r--r--Completion/Unix/Command/_vmstat28
2 files changed, 36 insertions, 40 deletions
diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat
index 8909ae311..f5291a19b 100644
--- a/Completion/Unix/Command/_iostat
+++ b/Completion/Unix/Command/_iostat
@@ -4,42 +4,53 @@ local -a args parser
parser=( -s -S -A '-*' )
case $OSTYPE:l in
- *bsd*)
+ *bsd*|dragonfly*)
args+=(
- '-c[repeat the display N times]:count'
+ '-c+[repeat the display N times]:count'
'-C[display CPU statistics]'
'-d[display only device statistics]'
'-I[display total statistics for a given period, rather than average]'
- '-M[extract values of the name list from specified file]:core:_files'
- '-N[extract the name list from the specified file]:system:_files'
'-T[display TTY statistics]'
- '-w[specify the duration of pauses between each display]:duration'
+ '-w+[specify the duration of pauses between each display]:duration'
+ '*: :_bsd_disks'
)
;|
- freebsd*)
+ freebsd*|openbsd*|dragonfly*)
+ args+=(
+ '-M+[extract values of the name list from specified file]:core:_files'
+ '-N+[extract the name list from the specified file]:system:_files'
+ )
+ ;|
+ freebsd*|dragonfly*)
args+=(
'-h[top mode]'
'-K[display block count in kilobytes, not block size]'
+ '-n+[display up to the specified number fo devices]:number of disks'
'-o[display old-style iostat device statistics]'
- '-t[specify which type of device to display]: :->devicetype'
+ '*-t+[specify which type of device to display]: :_fbsd_device_types'
+ )
+ ;|
+ freebsd*)
+ args+=(
'-x[show extended disk statistics]'
'-z[omit lines for devices with no activity]'
- '-?[display a usage statement and exit]'
- '*:drives:( ${${(M)${(f)"$(geom disk list)"}\:#Geom name\:*}#*\: } )'
+ '(* -)-?[display a usage statement and exit]'
)
;;
- openbsd*)
+ dragonfly*)
args+=(
- '-D[display alternate disk statistics]'
- '*:drives:( ${${(s.,.)"$(sysctl -n hw.disknames)"}%\:*} )'
+ '-D[display more details]'
)
;;
- netbsd*)
+ openbsd*|netbsd*)
args+=(
'-D[display alternate disk statistics]'
+ )
+ ;|
+ netbsd*)
+ args+=(
'-x[show extended disk statistics]'
'-y[report data on waiting and active requests]'
- '*:drives:( $(sysctl -n hw.disknames) )'
)
;;
aix*)
@@ -97,16 +108,17 @@ case $OSTYPE:l in
;;
darwin*)
args=(
+ '(- *)-?[display usage statement and exit]'
'-C[display CPU statistics]'
- '-c[number of times to display statistics]'
+ '-c+[number of times to display statistics]:count'
'-d[display only device statistics]'
- '-l[total statistics for a given time period]'
+ '-I[display total statistics for a given period, rather than average]'
'-K[display block count in kilobytes]'
- '-n[limit the number of disks included in the report]:number of disks'
+ '-n+[limit the number of disks included in the report]:number of disks'
'-o[display old-style iostat device statistics]'
'-T[display TTY statistics]'
'-U[display system load averages]'
- '-w[specify the duration of pauses between each display]:duration'
+ '-w+[specify the duration of pauses between each display]:duration'
'*::device:_files -W /dev -g "disk*"'
)
;;
diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat
index bc13a5505..f3ac1af14 100644
--- a/Completion/Unix/Command/_vmstat
+++ b/Completion/Unix/Command/_vmstat
@@ -28,11 +28,11 @@ case $OSTYPE in
'-M+[specify core file to extract values associated with the name list from]:core:_files'
'-N+[specify file to extract the name list from]:system:_files'
'-w+[specify delay between each display]:delay (seconds)'
- '*:disk:_files'
+ '*: :_bsd_disks'
)
;|
*bsd*)
- specs=(
+ specs+=(
'-f[report on the number fork syscalls since boot and pages of virtual memory for each]'
)
;|
@@ -89,12 +89,6 @@ case $OSTYPE in
'-v[include IRQ numbers and IRQ target CPU numbers before device names (with -i)]'
)
;;
- freebsd*|solaris*)
- specs+=(
- '::disk:_files -W /dev -g "*(-%b)"'
- ': :_guard "[0-9]#" "interval (seconds)"' ':count'
- )
- ;|
solaris2.<11->)
specs+=( '(-i -s)-T+[specify time format]:time format:((u\:seconds\ since\ epoch d\:standard\ date\ format))' )
;&
@@ -106,30 +100,20 @@ case $OSTYPE in
'-p[report paging activity]'
'(-T)-s[display the total number of system events since boot]'
'-S[report on swapping rather than paging activity]'
+ '::disk:_files -W /dev -g "*(-%b)"'
+ ': :_guard "[0-9]#" "interval (seconds)"' '::count'
)
;;
esac
if (( $#specs )); then
local curcontext=$curcontext state state_descr line ret=1
- typeset -A {opt,val}_args
+ typeset -A opt_args
_arguments -C -s -w -A '-*' : "$specs[@]" && ret=0
if [[ $state == devices ]]; then
- local -a types
- types=(
- 'da[direct access devices]' 'sa[sequential access devices]'
- 'printer[printers]' 'proc[processor devices]'
- 'worm[write once read multiple devices]' 'cd[CD devices]'
- 'scanner[scanner devices]' 'optical[optical memory devices]'
- 'changer[medium changer devices]' 'comm[communication devices]'
- 'array[storage array devices]' 'enclosure[enclosure services devices]'
- 'floppy[floppy devices]' 'IDE[Integrated Drive Electronics devices]'
- 'SCSI[Small Computer System Interface devices]'
- 'other[any other device interface]' 'pass[passthrough devices]'
- )
- _values -s , 'device type' "$types[@]" && ret=0
+ _fbsd_device_types && ret=0
elif [[ $state == hashes ]]; then
local -a tables
tables=( ${${${(f)"$(_call_program hashes $words[1] -L)"}[2,-1]#?}/ ##/:} )