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

Re: PATCH: _ssh (scp)



> It would be more consistent with normal file completion to add the
> files and directories together with the same tag and description.
> I'd also be tempted to setup separate display strings so that the * for
> executables, @ for symlinks etc are preserved in the file list.

This does that somewhat messily.

I intend to revert the bit where it checks PREFIX and in all cases
have it do an ls on the dirname.

However, I can't decide if it is better to
ls -a1F /dir (thereby getting all the dotfiles and potentially
respecting the local setting of GLOB_DOTS)
or
ls -d1F /dir/* (thereby respecting the remote setting of GLOB_DOTS or
equivalent)

Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.7
diff -u -r1.7 _ssh
--- Completion/Unix/Command/_ssh	2002/02/04 18:44:23	1.7
+++ Completion/Unix/Command/_ssh	2002/02/05 17:35:42
@@ -1,18 +1,26 @@
 #compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen
 
 _remote_files () {
-  # Rather than simple directory discrimination, there should be
-  # coloring based on all the different ls -F classifiers.
-  local expl remfiles
+  # There should be coloring based on all the different ls -F classifiers.
+  local expl remfiles remdispf remdispd
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
-    remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${words[CURRENT]#*:}\* 2>/dev/null)"})
+    if [[ $options[globdots] == "on" ]] && [[ "$PREFIX" == */ || -z "$PREFIX" ]];
+    then
+      print ssh -a -x ${words[CURRENT]%:*} ls -a1F ${words[CURRENT]#*:}
+      remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -a1F ${words[CURRENT]#*:} 2>/dev/null)"})
+    else
+      remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${words[CURRENT]#*:}\* 2>/dev/null)"})
+    fi
 
-    _wanted files expl 'remote files' \
-      compadd ${${remfiles:#*/}/[*=@|](#e)/}
+    remdispf=(${remfiles:#*/})
+    remdispd=(${(M)remfiles:#*/})
 
-    _wanted dirs expl 'remote directories' \
-      compadd -S/ ${${(M)remfiles:#*/}/\\/(#e)/}
+    _wanted files expl 'remote files and directories' \
+      compadd -d remdispf ${${remfiles:#*/}/[*=@|](#e)/}
+      
+    _wanted files expl 'remote files and directories' \
+      compadd -S/ -d remdispd ${${(M)remfiles:#*/}/\\/(#e)/}
   else
     _message 'remote files'
   fi



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