summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2002-02-04 18:03:02 +0000
committerClint Adams <clint@users.sourceforge.net>2002-02-04 18:03:02 +0000
commit190aef0e25ecb56bde977dfe75fdc84b4a12c7d4 (patch)
treefb07621e5767a6bd338f9c990941649cfd1675d8
parent2d35fd6ab0228ce2b698d7778c4ae134d7408a67 (diff)
downloadzsh-190aef0e25ecb56bde977dfe75fdc84b4a12c7d4.tar.gz
zsh-190aef0e25ecb56bde977dfe75fdc84b4a12c7d4.tar.xz
zsh-190aef0e25ecb56bde977dfe75fdc84b4a12c7d4.zip
16553: differentiate between files and directories during remote scp completion.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_ssh9
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6145549d2..0a6a8cf23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-02-04  Clint Adams  <clint@zsh.org>
+
+	* 16553: Completion/Unix/Command/_ssh: differentiate between
+	files and directories during remote scp completion.
+
 2002-02-03  Felix Rosencrantz  <f_rosencrantz@yahoo.com>
 
 	* 16546: Completion/Unix/Command/_cvs,
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 7d1d95d7c..8830db6ee 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -3,11 +3,16 @@
 _remote_files () {
   # This is extremely simple-minded; could parse "ls -F" output to do
   # colorings and LIST_TYPES and so on, but I'm just not that ambitious.
-  local expl
+  local expl remfiles
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
+    remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${words[CURRENT]#*:}\*)"})
+
     _wanted files expl 'remote files' \
-        compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
+      compadd ${${remfiles:#*/}/[*=@](#e)/}
+
+    _wanted dirs expl 'remote directories' \
+      compadd -S/ ${${(M)remfiles:#*/}/\\/(#e)/}
   else
     _message 'remote files'
   fi