zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: in vmstat completion handle Solaris and NetBSD
Date: Fri, 18 Aug 2017 19:04:17 +0200	[thread overview]
Message-ID: <ESSNFHYJNF.35ZAH6AHU2SRO@hydra.kiddle.eu> (raw)

Also added exclusion lists and other improvements.

Oliver

diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat
index 7082cbbd5..7d3008592 100644
--- a/Completion/Unix/Command/_vmstat
+++ b/Completion/Unix/Command/_vmstat
@@ -4,28 +4,31 @@ local -a specs
 case $OSTYPE in
   *linux*)
     specs=(
-      '(-a --active)'{-a,--active}'[active/inactive memory]'
-      '(-f --forks)'{-f,--forks}'[number of forks since boot]'
-      '(-m --slabs)'{-m,--slabs}'[slabinfo]'
-      '(-n --one-header)'{-n,--one-header}'[do not redisplay header]'
-      '(-s --stats)'{-s,--stats}'[event counter statistics]'
-      '(-d --disk)'{-d,--disk}'[disk statistics]'
-      '(-D --disk-sum)'{-D,--disk-sum}'[summarize disk statistics]'
-      '(-p --partition)'{-p,--partition}'[partition specific statistics]:partition:_files'
-      '(-S --unit)'{-S+,--unit}'[define display unit]:unit prefix:(( k\:1000 K\:1024 m\:1000000 M\:1048576 ))'
       '(-w --wide)'{-w,--wide}'[wide output]'
       '(-t --timestamp)'{-t,--timestamp}'[show timestamp]'
-      '1:delay' '2:count'
+      '(-n --one-header)'{-n,--one-header}'[do not redisplay header]'
+      '(-S --unit)'{-S+,--unit=}'[specify unit for displayed sizes]:unit prefix [K]:((k\:1000 K\:1024 m\:1000000 M\:1048576))'
+      '1: :_guard "[0-9]#" "interval (seconds)"' '2:count'
+      + '(action)' \
+      '(- :)'{-h,--help}'[display help information]'
+      '(- :)'{-V,--version}'[display version information]'
+      {-a,--active}'[show active/inactive memory]'
+      '(- :)'{-f,--forks}'[show number of forks since boot]'
+      '(-S --unit -t --timestamp -w --wide)'{-m,--slabs}'[show slabinfo]'
+      '(-w --wide -n --one-header -t --timestamp :)'{-s,--stats}'[show event counter statistics]'
+      {-d,--disk}'[show disk statistics]'
+      {-p+,--partition=}'[show partition specific statistics]:partition:_files -W /dev -g "*(-%)"'
+      '(- :)'{-D,--disk-sum}'[summarize disk statistics]'
     )
   ;;
-  freebsd*|openbsd*)
+  *bsd*)
     specs=(
-      '-c[number of times to refresh the display]:count'
+      '-c+[specify number of times to refresh the display]:count'
       '-f[report on the number fork syscalls since boot and pages of virtual memory for each]'
       '-i[report the number of interrupts taken by devices since boot]'
-      '-M[source file to extract values associated with the name list from]:core:_files'
-      '-N[source file to extract the name list from]:system:_files'
-      '-w[specify delay between each display]:delay (seconds)'
+      '-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'
     )
   ;|
@@ -35,23 +38,60 @@ case $OSTYPE in
       '-h[human readable memory columns output]'
       '-H[scriptable memory columns output]'
       '-m[report on the usage of kernel dynamic memory allocated using malloc(9) by type]'
-      '-n[change the maximum number of disks to display]:number of disks to display'
+      '-n+[change the maximum number of disks to display]:number of disks to display'
       '-o[list virtual memory objects]'
       '-P[report per-cpu system/user/idle cpu statistics]'
-      '-p[specify which types of devices to display]: :->devices'
-      '-s[display the contents of the SUM structure]:sum'
+      '-p+[specify which types of devices to display]: :->devices'
+      '-s[display the contents of the SUM structure]'
       '-z[report on memory used by the kernel zone allocator, uma(9), by zone]'
     )
-  ;;
-  openbsd*)
+  ;|
+  (net|open)bsd*)
     specs+=(
       '-m[report usage of kernel dynamic memory listed first by size of allocation then type of usage]'
-      '-s[display the contents of the UVMEXP structure]:uvmexp'
-      '-t[report on the number of page in and page reclaims since boot]'
+      '-s[display the contents of the UVMEXP structure]'
       '-v[print more verbose information]'
+    )
+  ;|
+  openbsd*)
+    specs+=(
+      '-t[report on the number of page in and page reclaims since boot]'
       '-z[include statistics about all interrupts]'
     )
   ;;
+  netbsd*)
+    specs+=(
+      '-C[report on kernel memory caches]'
+      '-e[report the values of system event counters]'
+      '-H[report all hash table statistics]'
+      '-h+[dump specified hash table]:hash table:->hashes'
+      '-L[list all hash tables]'
+      '-l[list UVM histories maintained by the kernel]'
+      '-t[display contents of the vmtotal structure]'
+      '-U[dump all UVM histories]'
+      '-u+[dump specified UVM history]:uvm'
+      '-W[print more information about kernel memory pools]'
+    )
+  ;;
+  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))' )
+  ;&
+  solaris*)
+    specs+=(
+      '-q[suppress messages related to state changes]'
+      + '(actions)' \
+      '(-T)-i[report the number of interrupts taken by devices since boot]'
+      '-p[report paging activity]'
+      '(-T)-s[display the total number of system events since boot]'
+      '-S[report on swapping rather than paging activity]'
+    )
+  ;;
 esac
 
 if (( $#specs )); then
@@ -73,7 +113,11 @@ if (( $#specs )); then
       'SCSI[Small Computer System Interface devices]'
       'other[any other device interface]' 'pass[passthrough devices]'
     )
-    _values -C -s , 'device type' "$types[@]" && ret=0
+    _values -s , 'device type' "$types[@]" && ret=0
+  elif [[ $state == hashes ]]; then
+   local -a tables
+   tables=( ${${${(f)"$(_call_program hashes $words[1] -L)"}[2,-1]#?}/ ##/:} )
+    _describe -t hashes 'hash table' tables && ret=0
   fi
   return ret
 fi


                 reply	other threads:[~2017-08-18 17:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ESSNFHYJNF.35ZAH6AHU2SRO@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).