1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00
freebsd-ports/shells/zsh/files/_sockstat
Dag-Erling Smørgrav 186692d099 Add some upstream completion patches + new completion files for
procstat, sockstat and fstat.

Submitted by:	Baptiste Daroussin <baptiste.daroussin@gmail.com>
2009-06-15 15:03:19 +00:00

24 lines
637 B
Plaintext

#compdef sockstat
local tmp_proto protocols proto
tmp_proto=(${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}})
for proto ($tmp_proto) {
case $proto in
*\#*)
protocols=($protocols ${${(j: :)${=proto}}// *\# /:})
;;
*)
protocols=($protocols ${${(j: :)${=proto}}// */})
esac
}
_arguments -s \
'-4[Show AF_INET (IPv4) sockets]' \
'-6[Show AF_INET6 (IPv6) sockets]' \
'-c[Show connected sockets]' \
'-l[Show listening sockets]' \
'-u[Show AF_LOCAL (UNIX) sockets]' \
'-p[Only show Internet sockets if the port number is on the specified list]' \
'-P[Only show sockets of the specified protocols]:protocols:(($protocols))'