Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: _ssh (scp)



> This still needs the 2>/dev/null fix I described in 16533.

Right.  Patch below.  Also adds | to the bracket expression.
We still need a solution to the zle redisplay problem.

> If you *are* going to parse "ls -F" output, you should remove the comment
> that indicates otherwise.

Well, it's not doing colorings, but I'll modify the comment.

> Another possible approach would be to use ls (without -d) on the directory
> parent of the remote path, and let the completion system filter out the
> non-matching names, rather than the rather crude hack I did of appending
> a `*' to the path.  This would support complete-in-word a bit better, but
> means more network traffic.

That should probably be configurable via an adjunct to the remote-access
style then.

Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.6
diff -u -r1.6 _ssh
--- Completion/Unix/Command/_ssh	2002/02/04 18:03:25	1.6
+++ Completion/Unix/Command/_ssh	2002/02/04 18:40:48
@@ -1,15 +1,15 @@
 #compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen
 
 _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.
+  # Rather than simple directory discrimination, there should be
+  # coloring based on all the different ls -F classifiers.
   local expl remfiles
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
-    remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${words[CURRENT]#*:}\*)"})
+    remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${words[CURRENT]#*:}\* 2>/dev/null)"})
 
     _wanted files expl 'remote files' \
-      compadd ${${remfiles:#*/}/[*=@](#e)/}
+      compadd ${${remfiles:#*/}/[*=@|](#e)/}
 
     _wanted dirs expl 'remote directories' \
       compadd -S/ ${${(M)remfiles:#*/}/\\/(#e)/}



Messages sorted by: Reverse Date, Date, Thread, Author