1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-17 10:20:55 +01:00

zsh-workers/7779

This commit is contained in:
Tanaka Akira 1999-09-12 00:02:40 +00:00
parent 602c2d8125
commit 189116eac0
4 changed files with 66 additions and 2 deletions

View file

@ -0,0 +1,9 @@
#autoload
# Usage: _hostport host
local host="$1"
shift
compadd "$@" - ${${(M)hosts\:#$host\:*}#*\:}

View file

@ -1,8 +1,8 @@
#compdef ftp ncftp ping rwho rup xping traceroute telnet
#compdef ftp ncftp ping rwho rup xping traceroute
local expl
: ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
_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[@]%:*}"

34
Completion/User/_socket Normal file
View file

@ -0,0 +1,34 @@
#compdef socket
local state line expl
typeset -A options
_arguments -s \
-{b,c,f,q,r,v,w} \
-{s,l} \
'-p:command:->command' \
':arg1:->arg1' \
':arg2:->arg2'
case "$state" in
command)
compset -q
_normal
;;
arg1)
if (( $+options[-s] )); then
_message 'port'
else
_description expl 'host'
_hosts "$expl[@]"
fi
;;
arg2)
if (( ! $+options[-s] )); then
_description expl 'port'
_hostports $line[2] "$expl[@]"
fi
;;
esac

21
Completion/User/_telnet Normal file
View file

@ -0,0 +1,21 @@
#compdef telnet
_arguments -s \
-{F,f,x} \
'-8[allow 8-Bit data]' \
'-E[disable an escape character]' \
'-K[no automatic login]' \
'-L[allow 8-Bit data on output]' \
'-S+:IP type-of-service:' \
'-X+:authentication type to disable:' \
'-a[attempt automatic login]' \
'-c[disable .telnetrc]' \
'-d[debug mode]' \
'-e+[specify escape character]:escape character:' \
'-k+:realm:' \
'-l+[specify user]:user:' \
'-n+[specify tracefile]:tracefile:_files' \
'-r[rlogin like user interface]' \
':host:_hosts' \
':port:{ _hostports $line[2] "$expl[@]" }'