mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-01 21:51:40 +02:00
53807: new completion for nettop command
This commit is contained in:
parent
f3b2aab86d
commit
f5abf18f2c
2 changed files with 62 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
2025-06-01 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 53807: Completion/Darwin/Command/_nettop: new completion
|
||||
|
||||
* 53806: Completion/Unix/Command/_lldb: fix/update _lldb
|
||||
|
||||
* 53805: Completion/Unix/Command/_less: update for less-678
|
||||
|
|
60
Completion/Darwin/Command/_nettop
Normal file
60
Completion/Darwin/Command/_nettop
Normal file
|
@ -0,0 +1,60 @@
|
|||
#compdef nettop
|
||||
|
||||
local curcontext="$curcontext" state state_descr line ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
local msg='number of samples (0=infinite)'
|
||||
local specs=(
|
||||
'-m+[specify the mode]:mode:(tcp udp route)'
|
||||
'*-t+[specify interface type]:interface type:(wifi wired loopback owdl expensive undefined external)'
|
||||
'-n[disable address to name resolution]'
|
||||
'-c[less intensive use of the CPU]'
|
||||
'-d[delta mode]'
|
||||
'-x[extended display of numbers instead of suffixes such as MiB]'
|
||||
'-P[display per-process summaries only]'
|
||||
'-s+[specify delay between updates]: :_numbers -u seconds -d 1 delay'
|
||||
"(-L)-l+[display specified number of samples and exit]:$msg"
|
||||
"(-l)-L+[display specified number of samples in CSV and exit]:$msg"
|
||||
'*-p+[select a particular process]: :->process'
|
||||
'-j+[include the specified columns]: :->columns-off'
|
||||
'-J+[include only the specified columns]: :->columns-all'
|
||||
'-k+[exclude the specified columns]: :->columns-on'
|
||||
'(-)-h[display help message and exit]'
|
||||
)
|
||||
|
||||
_arguments -s -C : $specs && ret=0
|
||||
|
||||
case $state in
|
||||
columns-*)
|
||||
local columns_on=( # columns included by default
|
||||
interface state bytes_in bytes_out rx_dupe rx_ooo re-tx rtt_avg
|
||||
rcvsize tx_win tc_class tc_mgt cc_algo P C R W
|
||||
arch
|
||||
)
|
||||
local columns_off=( # not included by default
|
||||
type packets_in packets_out rtt_min rtt_var
|
||||
sndsize sndused rcvused unacked tx_cwin
|
||||
cell_bytes_in cell_bytes_out wifi_bytes_in wifi_bytes_out
|
||||
wired_bytes_in wired_bytes_out
|
||||
uuid epid euuid vuuid closed_tcp closed_udp
|
||||
)
|
||||
case $state in
|
||||
columns-on)
|
||||
_values -s , 'column name' $columns_on && ret=0
|
||||
;;
|
||||
columns-off)
|
||||
_values -s , 'column name' $columns_off && ret=0
|
||||
;;
|
||||
columns-all)
|
||||
_values -s , 'column name' $columns_on $columns_off && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
process)
|
||||
local procs=( ${(@)${(f@)"$(_call_program processes-names
|
||||
$words[1] -P -l 1 -J '')"}%.[0-9]*} )
|
||||
_alternative 'processes-names:process name:($procs)' \
|
||||
'processes:pid:_pids' && ret=0
|
||||
esac
|
||||
|
||||
return ret
|
Loading…
Reference in a new issue