summaryrefslogtreecommitdiff
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_rlogin29
1 files changed, 28 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin
index bdfe2b44c..32f49e19a 100644
--- a/Completion/Unix/Command/_rlogin
+++ b/Completion/Unix/Command/_rlogin
@@ -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