1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 22:11:54 +02:00

18058: complete remote files for rcp

This commit is contained in:
Oliver Kiddle 2003-01-07 08:51:10 +00:00
parent cd28eb9c71
commit 0e037e4d99
2 changed files with 37 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2003-01-07 Oliver Kiddle <opk@zsh.org>
* 18058: Completion/Unix/Command/_lsof, Completion/Unix/Command/_mt,
Completion/Unix/Command/_xsltproc, Completion/Unix/Command/_rlogin,
Completion/Unix/Command/_ssh, Completion/Unix/Command/_ant,
Completion/Unix/Command/.distfiles: new completions for lsof, mt and
xsltproc, complete remote files for rcp, allow multiple port
redirections with ssh and a typo correction in _ant
2002-12-18 Peter Stephenson <pws@csr.com>
* 18015: Src/math.c: empty math parse e.g. $(( )) acts like a zero.

View file

@ -1,5 +1,32 @@
#compdef rlogin rsh remsh=rsh rcp
_rcp_remote_files () {
# There should be coloring based on all the different ls -F classifiers.
local expl remfiles remdispf remdispd suf ret=1
if zstyle -T ":completion:${curcontext}:" remote-access; then
remfiles=(${(M)${(f)"$(rsh ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
compset -P '*/'
compset -S '/*' || suf='remote file'
remdispf=(${remfiles:#*/})
remdispd=(${(M)remfiles:#*/})
_tags files
while _tags; do
while _next_label files expl ${suf:-remote directory}; do
[[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \
${remdispf%[*=@|]} && ret=0
compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
${remdispd%/} && ret=0
done
(( ret )) || return 0
done
else
_message -e remote-files 'remote file'
fi
}
_rlogin () {
case "$service" in
rlogin)
@ -38,7 +65,7 @@ _rlogin () {
if [[ -n "$state" ]]; then
if compset -P '*:'; then
_files && ret=0
_rcp_remote_files && ret=0
elif compset -P '*@'; then
_wanted hosts expl host _rlogin_hosts -S: && ret=0
else