Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: update completions for Linux sysstat



This updates completions for sysstat commands up to version 11.6.0.
Mostly this is just a bunch of extra options.

With regard to the old comment in there about nfsiostat, I can only find
the oracle implementation.
The comment about -V appearing with other options doesn't appear to
apply any more or at least I couldn't work out what other options it
might be combined with.

Oliver

diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat
index e976b4705..855bf0a70 100644
--- a/Completion/Linux/Command/_sysstat
+++ b/Completion/Linux/Command/_sysstat
@@ -1,15 +1,17 @@
 #compdef mpstat cifsiostat isag sadf sar pidstat
-# -V can appear with other options, so (- *) isn't needed.
 #TODO:
 # sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat.
 
 _mpstat() {
-  _arguments : \
-    '-A[equivalent to -u -I ALL -P ALL]' \
-    '-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
-    '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
+  _arguments -S : \
+    '(-n -u -I -N -P)-A[equivalent to -n -u -I ALL -N ALL -P ALL]' \
+    '(-A)-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
+    '(-A)-N[specify NUMA nodes]:NUMA node' \
+    '(-A)-n[report summary CPU statistics based on NUMA node placement]' \
+    '-o[display statistics in JSON]:format:(JSON)' \
+    '(-A)-P[specify processor number]:processor: _values -s "," processor ON ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
     '-u[report CPU utilization]' \
-    '-V[print version number]' \
+    '(- 1 2)-V[display version information]' \
     '1: : _guard "^-*" interval' \
     '2: : _guard "^-*" count'
 }
@@ -20,7 +22,8 @@ _cifsiostat() {
     '(-m)-k[display statistics in kB/s]' \
     '(-k)-m[display statistics in MB/s]' \
     '-t[print timestamp for each report]' \
-    '-V[print version number]' \
+    '(- 1 2)-V[print version number]' \
+    '--human[print sizes in human readable format]' \
     '1: : _guard "^-*" interval' \
     '2: : _guard "^-*" count'
 }
@@ -34,50 +37,62 @@ _isag() {
 }
 
 _sadf() {
-  local ret=1
+  local i ret=1
   # any options after `--' are for sar(1)
-  if ! (( CURRENT > $words[(i)--] )); then
+  if (( CURRENT <= $words[(i)--] )); then
     _arguments : \
       '-C[display comments in file]' \
-      '(-j -p -x)-d[output file in SQL format]' \
+      '-c[convert an old datafile to the new format]' \
       '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
       '-H[display only the header of the report]' \
-      '(-j -p -x)-h[print on a single line when used with -d]' \
-      '(-d -p -x)-j[output file in JSON]' \
+      '(-g -j -p -r -x)-h[print on a single line when used with -d]' \
+      '-O[specify output options]: : _values -s , option
+        autoscale height\:value oneday packed showidle showinfo skipempty showhints' \
       '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
-      '(-j -x -d)-p[print in format parsable by tools like awk]' \
       '-s[set starting time of report]:starting time (HH\:MM\:SS)"' \
       '(-t -U)-T[display timestamp in local time]' \
       '(-T -U)-t[display timestamp in file\''s original localtime]' \
       '(-t -T)-U[display in seconds since epoch (UTC)]' \
-      '-V[print version number]' \
-      '(-j -d -p)-x[output file in XML]' \
+      '(- 1 2 3)-V[print version number]' \
       '1: : _guard "^-*" interval' \
       '2: : _guard "^-*" count' \
-      '3:data file:_files' && ret=0
+      '3:data file:_files' \
+      + '(format)' \
+      '-d[output file in SQL format]' \
+      '-g[print data in SVG format]' \
+      '-j[output file in JSON]' \
+      '-p[print in format parsable by tools like awk]' \
+      '-r[print raw contents of data file]' \
+      '-x[output file in XML]' \
+      && ret=0
   else
-    _arguments : '*::sar: _sar' && ret=0
+    (( i = words[(i)--] - 1, CURRENT -= i ))
+    shift i words
+    _sar && ret=0
   fi
   return ret
 }
 
 _sar() {
-  _arguments : \
-    '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL]' \
+  _arguments -s : \
+    '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -r ALL -u ALL -P ALL]' \
     '-B[report paging statistics]' \
     '-b[report I/O and transfer rate statistics]' \
     '-C[display comments from sadc]' \
+    '-D[use saYYYYMMDD instead of saDD as the standard system activity daily data file name]' \
     '-d[report activity for each block device]' \
     '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
     '-F[display statistics for mounted filesystems]' \
     '-f[extract records from file]:record:_files' \
     '-H[report hugepages utilization]' \
     '-h[display help]' \
+    '--human[print sizes in human readable format]' \
     '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
     '-i[select records as close as possible to interval]:interval' \
     '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \
     '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \
     '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \
+    '-o[save readings to file in binary form]:file:_files' \
     '-P[report per-processor statistics]:processor: _values -s "," processors ALL' \
     '-p[pretty-print device names]' \
     '-q[report queue length and load averages]' \
@@ -85,8 +100,10 @@ _sar() {
     '-r[report memory utilization statistics]' \
     '-S[report swap space utilization]' \
     '-s[set starting time of report]:start time (HH\:MM\:SS)' \
+    '--sadc[print name of data collector]' \
+    '-t[display timestamps in original local time of file creator]' \
     '-u[report CPU utilization]: :(ALL)' \
-    '-V[print version number]' \
+    '(- 1 2)-V[display version information]' \
     '-v[report status of kernel tables]' \
     '-W[report swapping statistics]' \
     '-w[report task creation and system switching activity]' \
@@ -96,22 +113,27 @@ _sar() {
 }
 
 _pidstat() {
-  _arguments : \
+  _arguments -s : \
     '-C[filter tasks by string]:task filter' \
     '-d[report I/O statistics]' \
-    '-h[display on horizontally]' \
+    '-e[execute specified program and monitor it with pidstat]:*::command: _normal' \
+    '-H[display timestamp in seconds since the epoch]' \
+    '-h[display horizontally]' \
     '-I[divide CPU usage by number of processors]' \
     '-l[display process name along with arguments]' \
-    '-p[select pid]:pid: _sequence _pids' \
+    '*-p[select pid]:pid: _sequence _pids' \
+    '-R[report realtime priority and scheduling policy information]' \
     '-r[report page faults and memory]' \
     '-s[report stack utilization]' \
     '-T[specifies what to monitor]:type:(TASK CHILD ALL)' \
     '-t[display statistics for threads]' \
     '-U[display real username of tasks]::username:_users' \
     '-u[report cpu utilization]' \
-    '-V[print version number]' \
+    '(- 1 2)-V[display version information]' \
     '-v[display values from kernel table]' \
     '-w[report task switching activity]' \
+    '-G[include only processes with specified name]:process name' \
+    '--human[print sizes in human readable format]' \
     '1: : _guard "^-*" interval' \
     '2: : _guard "^-*" count'
 }
diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat
index 88fc6a103..e95d62f80 100644
--- a/Completion/Unix/Command/_iostat
+++ b/Completion/Unix/Command/_iostat
@@ -1,6 +1,7 @@
 #compdef iostat
 
-local -a args
+local -a args parser
+parser=( -s -S -A '-*' )
 
 case $OSTYPE:l in
   *bsd*)
@@ -109,23 +110,32 @@ case $OSTYPE:l in
     )
     ;;
   *linux*)
+    parser=( -s )
     args=(
       '-c[display CPU utilization report]'
       '-d[display device utilization report]'
-      '-T[only display global statistics for group_name]'
-      '-g[display statistics for a group of devices]:group name'
-      '-h[human readable device utilization report]'
-      '-j[display persistent device name]'
+      '*-g[display statistics for a group of devices]:group name'
+      '-H[only display global statistics for group]'
+      '(--human)-h[human readable device utilization report]'
+      '--human[print sizes in human readable format]'
+      '-j[display persistent device name]:name type:(ID LABEL PATH UUID)'
       '(-m)-k[display statistics in kB/s]'
       '(-k)-m[display statistics in MB/s]'
       '-N[display registered device mapper names]'
+      '-o[display statistics in JSON]:format:(JSON)'
+      '-p[display statistics for block devices]'
+      '-t[display the time for each report]'
+      '(- *)-V[display version information]'
+      '-x[display extended statistics]'
+      '-y[omit first statistics report following system boot]'
+      '-z[omit output for devices lacking activity]'
       '*::device:_files -W /dev -g "*(-%)"'
     )
     ;;
 esac
 
 if (( $#args )); then
-  _arguments -s -w -A '-*' : $args
+  _arguments $parser : $args
   return
 fi
 

.



Messages sorted by: Reverse Date, Date, Thread, Author