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:
parent
602c2d8125
commit
189116eac0
4 changed files with 66 additions and 2 deletions
9
Completion/User/_hostports
Normal file
9
Completion/User/_hostports
Normal file
|
@ -0,0 +1,9 @@
|
|||
#autoload
|
||||
|
||||
# Usage: _hostport host
|
||||
|
||||
local host="$1"
|
||||
shift
|
||||
|
||||
compadd "$@" - ${${(M)hosts\:#$host\:*}#*\:}
|
||||
|
|
@ -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
34
Completion/User/_socket
Normal 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
21
Completion/User/_telnet
Normal 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[@]" }'
|
||||
|
Loading…
Reference in a new issue