From 13fc579343b24d298fb8905933b6000d7fcda114 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 14 Oct 2014 23:03:40 +0200 Subject: 33467: correct return status on functions and numerous other minor fixes --- Completion/Linux/Command/_sysstat | 77 +++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 44 deletions(-) (limited to 'Completion/Linux') diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index 60de9d899..2a7128c23 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -4,80 +4,73 @@ # sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat. _mpstat() { - local ret=1 _arguments : \ '-A[equivalent to -u -I ALL -P ALL]' \ - '-I[report interrupt statistics]:interrupts:(SUM CPU SCPU ALL)' \ - '-P[specify processor number]:processor: _values -s "," processor ON 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)}' \ '-u[report CPU utilization]' \ '-V[print version number]' \ - '1:interval:_guard "[0-9]#" "interval"' \ - '2:count:_guard "[0-9]#" "count"' && ret=0 - return ret + '1:interval' \ + '2:count' } _iostat() { - local ret=1 _arguments : \ '-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: _message "group name"' \ + '-g[display statistics for a group of devices]:group name' \ '-h[human readable device utilization report]' \ '-j[display persistent device name]' \ '(-m)-k[display statistics in kB/s]' \ '(-k)-m[display statistics in MB/s]' \ '-N[display registered device mapper names]' \ - '1:interval:_guard "[0-9]#" "interval"' \ - '2:count:_guard "[0-9]#" "count"' && ret=0 - return ret + '::device:_files -W /dev -g "*(-%)"' \ + ': :_guard "[0-9]#" "interval"' \ + ':count' } _cifsiostat() { - local ret=1 _arguments : \ '-h[human readable]' \ '(-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:interval:_guard "[0-9]#" "interval"' \ - '2:count:_guard "[0-9]#" "count"' && ret=0 - return ret + '1:interval' \ + '2:count' } _isag() { - local ret=1 _arguments : \ - '-p[Pathname to daily data files]:data files: _files -/' \ - '-c[Specify configuration file]:configuration file: _files' \ - '-ght[Specify height of the chart]:height: _message "height"' \ - '-gwd[Specify width of the chart]:width: _message "width"' && ret=0 - return ret + '-p[specify path to daily data files]:path:_files -/' \ + '-c[specify configuration file]:configuration file:_files' \ + '-ght[specify height of the chart]:height' \ + '-gwd[specify width of the chart]:width' } _sadf() { - local ret=1 line state context expl - typeset -A opt_args + local ret=1 # any options after `--' are for sar(1) if ! (( CURRENT > $words[(i)--] )); then _arguments : \ '-C[display comments in file]' \ '(-j -p -x)-d[output file in SQL format]' \ - '-e[set ending time of report]:ending time: _message "ending time in localtime(HH\:MM\:SS 24-hour 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]' \ '-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: _message "starting time in localtime(HH\:MM\:SS 24-hour format)"' \ + '-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 from epoch(UTC)]' \ + '(-t -T)-U[display in seconds since epoch (UTC)]' \ '-V[print version number]' \ '(-j -d -p)-x[output file in XML]' \ - '1:interval:_guard "[0-9]#" "interval"' \ - '2:count:_guard "[0-9]#" "count"' && ret=0 + '1:interval' \ + '2:count' \ + '3:data file:_files' && ret=0 else _arguments : '*::sar: _sar' && ret=0 fi @@ -85,20 +78,19 @@ _sadf() { } _sar() { - local ret=1 _arguments : \ '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL]' \ '-B[report paging statistics]' \ '-b[report I/O and transfer rate statistics]' \ '-C[display comments from sadc]' \ '-d[report activity for each block device]' \ - '-e[set ending time of report]:ending time: _message "ending time (HH\:MM\:SS 24-hour format)"' \ + '-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]' \ '*-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: _message "interval"' \ + '-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' \ @@ -108,27 +100,25 @@ _sar() { '-R[report memory statistics]' \ '-r[report memory utilization statistics]' \ '-S[report swap space utilization]' \ - '-s[set starting time of report]:start time: _message "start time (HH\:MM\:SS 24-hour format)"' \ + '-s[set starting time of report]:start time (HH\:MM\:SS)' \ '-u[report CPU utilization]: :(ALL)' \ '-V[print version number]' \ '-v[report status of kernel tables]' \ '-W[report swapping statistics]' \ '-w[report task creation and system switching activity]' \ '-y[report TTY device activity]' \ - '1:interval:_guard "[0-9]#" "interval"' \ - '2:count:_guard "[0-9]#" "count"' && ret=0 - return ret + '1:interval' \ + '2:count' } _pidstat() { - local ret=1 _arguments : \ - '-C[filter tasks by string]:task: _message "string or regex"' \ + '-C[filter tasks by string]:task filter' \ '-d[report I/O statistics]' \ '-h[display on horizontally]' \ '-I[divide CPU usage by number of processors]' \ '-l[display process name along with arguments]' \ - '-p[select pid]:pid: _pids' \ + '-p[select pid]:pid: _sequence _pids' \ '-r[report page faults and memory]' \ '-s[report stack utilization]' \ '-T[specifies what to monitor]:type:(TASK CHILD ALL)' \ @@ -137,14 +127,13 @@ _pidstat() { '-u[report cpu utilization]' \ '-V[print version number]' \ '-v[display values from kernel table]' \ - '-w[report task switching activity]' && ret=0 - return ret + '-w[report task switching activity]' \ + ':interval' ':count' } _sysstat() { - local ret=1 - _call_function ret _$service - return ret -} + local ret + _call_function ret _$service && return ret +} _sysstat "$@" -- cgit 1.4.1