mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
21081: complete network services for the psmisc version of fuser
This commit is contained in:
parent
e75966d3c7
commit
5a67b1323e
@ -1,3 +1,10 @@
|
||||
2005-04-01 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 21081: Completion/Unix/Command/_fuser: complete network
|
||||
services for the psmisc version of fuser
|
||||
|
||||
* unposted: Completion/Unix/Command/_subversion: minor correction
|
||||
|
||||
2005-04-01 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* c.f. 21071: Doc/Zsh/{builtins.yo,compsys.yo,compwid.yo,func.yo,
|
||||
|
@ -1,42 +1,67 @@
|
||||
#compdef fuser
|
||||
|
||||
local -a args arg1
|
||||
typeset -A opt_args
|
||||
|
||||
if _pick_variant -c $words[1] psmisc=psmisc unix -V; then
|
||||
|
||||
(( $+functions[_fuser_services] )) ||
|
||||
_fuser_services() {
|
||||
local expl suf ret=1
|
||||
|
||||
[[ $opt_args[-n] = ??p || $EUID = 0 ]] || return
|
||||
|
||||
if compset -P '*/'; then
|
||||
_wanted protocols expl protocol compadd tcp udp
|
||||
elif compset -P '*,*,'; then
|
||||
compset -S '/*' || [[ -n $opt_args[-n] ]] || suf=( -qS / )
|
||||
_ports $suf && ret=0
|
||||
elif compset -P '*,'; then
|
||||
compset -S ',*' || suf=( -S , -r "/ \t\n\-" )
|
||||
_hosts $suf && ret=0
|
||||
else
|
||||
compset -S ',*' || suf=( -S ${${opt_args[-n]/?*/,}:-/} -r "/, \t\n\-" )
|
||||
_ports $suf && ret=0
|
||||
fi
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
if _pick_variant -c $words[1] gnu=GNU unix -V; then
|
||||
_arguments \
|
||||
'(-s)-a[show all files specified on the command line]' \
|
||||
{-c,-m}'[list all processes accessing files on the filesystem specified by name]' \
|
||||
'-k[kill processes accessing the file]' \
|
||||
'-i[ask for confirmation before killing]' \
|
||||
'-l[list all known signal names]' \
|
||||
'-n[select name space]:namespace:(file udp tcp)' \
|
||||
'(-a)-s[silent operation]' \
|
||||
'-signal[send alternate signal with -k]:signal:_signals' \
|
||||
'-u[append the user name of the process owner to each PID]' \
|
||||
'-v[verbose mode]' \
|
||||
'-V[display version information]' \
|
||||
'-4[search only for IPv4 sockets]' \
|
||||
'-6[search only for IPv6 sockets]' \
|
||||
':name:_files'
|
||||
'(-s)-a[show all files specified on the command line]' \
|
||||
{-c,-m}'[list all processes accessing files on the filesystem specified by name]' \
|
||||
'-k[kill processes accessing the file]' \
|
||||
'-i[ask for confirmation before killing]' \
|
||||
'-l[list all known signal names]' \
|
||||
'-n[select name space]:namespace:(file udp tcp)' \
|
||||
'(-a)-s[silent operation]' \
|
||||
'-signal[send alternate signal with -k]:signal:_signals' \
|
||||
'-u[append the user name of the process owner to each PID]' \
|
||||
'-v[verbose mode]' \
|
||||
'-V[display version information]' \
|
||||
'-4[search only for IPv4 sockets]' \
|
||||
'-6[search only for IPv6 sockets]' \
|
||||
'*:name: _alternative "files:file:_files" "services:service:_fuser_services"'
|
||||
|
||||
else
|
||||
case $OSTYPE in
|
||||
solaris2.9 )
|
||||
args=(
|
||||
'-n[list only processes with non-blocking mandatory locks]'
|
||||
'-s[send alternate signal with -k]:signal:_signals'
|
||||
'-n[list only processes with non-blocking mandatory locks]'
|
||||
'-s[send alternate signal with -k]:signal:_signals'
|
||||
)
|
||||
;;
|
||||
sysv4 )
|
||||
(( $+words[(r)-k] )) && arg1=( ':signal: _alternative signals\:signal\:_signals\ -p files:name:_files' )
|
||||
(( $+words[(r)-k] )) && arg1=( ':name: _alternative signals\:signal\:_signals\ -p files:file:_files' )
|
||||
;;
|
||||
esac
|
||||
|
||||
_arguments \
|
||||
'(-f)-c[list all processes accessing files on the filesystem specified by name]' \
|
||||
'(-c)-f[list all processes accessing named files]' \
|
||||
'-k[kill processes accessing the file]' \
|
||||
'-u[append the user name of the process owner to each PID]' \
|
||||
$args \
|
||||
$arg1 \
|
||||
'*:name:_files'
|
||||
'(-f)-c[list all processes accessing files on the filesystem specified by name]' \
|
||||
'(-c)-f[list all processes accessing named files]' \
|
||||
'-k[kill processes accessing the file]' \
|
||||
'-u[append the user name of the process owner to each PID]' \
|
||||
$args \
|
||||
$arg1 \
|
||||
'*:file:_files'
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user