summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-01-07 08:51:10 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-01-07 08:51:10 +0000
commit0e037e4d99a109620f4413d18a38f9d955051ccd (patch)
tree042812dbce24f310f7e61deb367a6499109b2d59
parentcd28eb9c7104aaee83fcd3857cac4e7794af10c8 (diff)
downloadzsh-0e037e4d99a109620f4413d18a38f9d955051ccd.tar.gz
zsh-0e037e4d99a109620f4413d18a38f9d955051ccd.tar.xz
zsh-0e037e4d99a109620f4413d18a38f9d955051ccd.zip
18058: complete remote files for rcp
-rw-r--r--ChangeLog9
-rw-r--r--Completion/Unix/Command/_rlogin29
2 files changed, 37 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e35f1d89..68b6cdf1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
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