1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-01 21:51:40 +02:00

42520: don't use an empty but existing option cache in netcat completion

This commit is contained in:
Oliver Kiddle 2018-03-24 15:16:07 +01:00
parent a2459bee79
commit 383077e0da
2 changed files with 8 additions and 4 deletions

View file

@ -1,5 +1,8 @@
2018-03-24 Oliver Kiddle <okiddle@yahoo.co.uk>
* 42520: Completion/Unix/Command/_netcat: don't use an empty
but existing option cache in netcat completion
* 42521 based on 42049 (SATOH Fumiyasu):
Completion/Unix/Command/_make: make always includes relative
to the current directory rather than relative to the Makefile

View file

@ -6,11 +6,12 @@ if [[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h; then
return
fi
if (( ! $+_nc_args )); then
if (( ! $#_cache_nc_args )); then
typeset -ga _cache_nc_args
local help="$(_call_program options $words[1] -h < /dev/null 2>&1)"
local -A optionmap
optionmap=(
'*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e'
'*-e prog*' '-e+[program to exec after connect]:program:_command_names -e'
'*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts'
'*-G num*' '-G[source-routing pointer: 4, 8, 12]'
'*-i secs*' '-i+[delay interval for lines sent or ports scanned]:delay (secs)'
@ -28,10 +29,10 @@ if (( ! $+_nc_args )); then
'*-x*' '-x'
'*-b*' '-b[allow broadcasts]'
)
_nc_args=($optionmap[(K)"$help"])
_cache_nc_args=( $optionmap[(K)"$help"] )
fi
_arguments -s \
"$_nc_args[@]" \
"$_cache_nc_args[@]" \
':host:_hosts' \
':port:_ports'