mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-15 14:21:13 +02:00
36889: completion of system specific sockstat options
This commit is contained in:
parent
509c822b62
commit
d8f8d3e534
2 changed files with 34 additions and 19 deletions
|
@ -1,5 +1,8 @@
|
||||||
2015-10-19 Oliver Kiddle <opk@zsh.org>
|
2015-10-19 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* 36889: Eric Cook: Completion/BSD/Command/_sockstat:
|
||||||
|
completion of system specific sockstat options
|
||||||
|
|
||||||
* 36869: Matthew Martin: Completion/Unix/Command/_ssh: use
|
* 36869: Matthew Martin: Completion/Unix/Command/_ssh: use
|
||||||
permissions to limit files completed for ssh identity files
|
permissions to limit files completed for ssh identity files
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,35 @@
|
||||||
#compdef sockstat
|
#compdef sockstat
|
||||||
|
local -a args
|
||||||
|
|
||||||
local tmp_proto protocols proto
|
case $OSTYPE in
|
||||||
|
*bsd*)
|
||||||
tmp_proto=(${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}})
|
args=(
|
||||||
for proto ($tmp_proto) {
|
'-4[show AF_INET (IPv4) sockets]'
|
||||||
case $proto in
|
'-6[show AF_INET6 (IPv6) sockets]'
|
||||||
*\#*)
|
'-c[show connected sockets]'
|
||||||
protocols=($protocols ${${(j: :)${=proto}}// *\# /:})
|
'-l[show listening sockets]'
|
||||||
|
'*-p[specify port number]:port numbers (comma delimited)'
|
||||||
|
'-u[show AF_LOCAL (UNIX) sockets]'
|
||||||
|
)
|
||||||
|
;|
|
||||||
|
freebsd*)
|
||||||
|
args+=(
|
||||||
|
'*-j[show sockets belonging to JID]: : _jails -0 -o jid'
|
||||||
|
'-L[exclude loopback]'
|
||||||
|
'*-P[specify protocol]: :_sequence -s , _ports'
|
||||||
|
)
|
||||||
;;
|
;;
|
||||||
*)
|
netbsd*)
|
||||||
protocols=($protocols ${${(j: :)${=proto}}// */})
|
args+=(
|
||||||
esac
|
'*-f[only show specified address family]:address family:(inet inet6 local unix)'
|
||||||
}
|
'-n[no symbolic names for addresses/ports]'
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
_arguments -s \
|
if (( $#args )); then
|
||||||
'-4[show AF_INET (IPv4) sockets]' \
|
_arguments -s -w $args
|
||||||
'-6[show AF_INET6 (IPv6) sockets]' \
|
return
|
||||||
'-c[show connected sockets]' \
|
fi
|
||||||
'-l[show listening sockets]' \
|
|
||||||
'-u[show AF_LOCAL (UNIX) sockets]' \
|
_default
|
||||||
'-p[only show Internet sockets if the port number is on the specified list]' \
|
|
||||||
'-P[only show sockets of the specified protocols]:protocols:(($protocols))'
|
|
||||||
|
|
Loading…
Reference in a new issue