1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-06 09:01:13 +02:00

zsh-workers/7781

This commit is contained in:
Tanaka Akira 1999-09-12 03:38:15 +00:00
parent 189116eac0
commit e644c39ba1
3 changed files with 24 additions and 7 deletions

View file

@ -5,4 +5,4 @@ local expl
: ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
_description expl host _description expl host
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "${hosts[@]%:*}" compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$hosts[@]"

View file

@ -1,5 +1,12 @@
#compdef socket #compdef socket
# Parameter used:
#
# socket_ports
# The associative array that maps a host name to a space-separated list of
# ports.
local state line expl local state line expl
typeset -A options typeset -A options
@ -18,17 +25,21 @@ command)
arg1) arg1)
if (( $+options[-s] )); then if (( $+options[-s] )); then
_message 'port' _message 'port to listen'
else else
_description expl 'host' _description expl 'host'
_hosts "$expl[@]" compadd "$expl[@]" - ${(k)socket_ports} || _hosts "$expl[@]"
fi fi
;; ;;
arg2) arg2)
if (( ! $+options[-s] )); then if (( ! $+options[-s] )); then
_description expl 'port' _description expl 'port to connect'
_hostports $line[2] "$expl[@]" if (( $+socket_ports )); then
compadd "$expl[@]" - ${=socket_ports[$line[2]]};
else
_message 'port to connect';
fi
fi fi
;; ;;
esac esac

View file

@ -1,5 +1,11 @@
#compdef telnet #compdef telnet
# Parameter used:
#
# telnet_ports
# The associative array that maps a host name to a space-separated list of
# ports.
_arguments -s \ _arguments -s \
-{F,f,x} \ -{F,f,x} \
'-8[allow 8-Bit data]' \ '-8[allow 8-Bit data]' \
@ -16,6 +22,6 @@ _arguments -s \
'-l+[specify user]:user:' \ '-l+[specify user]:user:' \
'-n+[specify tracefile]:tracefile:_files' \ '-n+[specify tracefile]:tracefile:_files' \
'-r[rlogin like user interface]' \ '-r[rlogin like user interface]' \
':host:_hosts' \ ':host:{ compadd "$expl[@]" - ${(k)telnet_ports} || _hosts "$expl[@]" }' \
':port:{ _hostports $line[2] "$expl[@]" }' ':port:{ if (( $+telnet_ports )); then compadd "$expl[@]" - ${=telnet_ports[$line[2]]}; else _message "port"; fi }'