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

Re: scp completion



On 2 Sep, you wrote:
> 
> zsh's completion for scp lacks a feature :)

> That doesn't work when I have to use "-P" to scp:
> 
> scp -P 2222 foo@bar:/some/path<TAB>

Yes, we need to pass the port number on to the ssh command used to get
the list of files to complete.

> Is there any chance that this feature will be implemented soon or

Patch below should do it.

Can anyone think of which if any of the other scp options should be
passed on? I've got it to also pass on -1,-2,-4 and -6.

Oliver

Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.14
diff -u -r1.14 _ssh
--- Completion/Unix/Command/_ssh	16 Apr 2002 07:48:46 -0000	1.14
+++ Completion/Unix/Command/_ssh	3 Sep 2002 08:59:57 -0000
@@ -2,10 +2,11 @@
 
 _remote_files () {
   # There should be coloring based on all the different ls -F classifiers.
-  local expl remfiles remdispf remdispd suf ret=1
+  local expl remfiles remdispf remdispd args suf ret=1
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
-    remfiles=(${(M)${(f)"$(ssh -a -x ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
+    zparseopts -D -E -a args p: 1 2 4 6
+    remfiles=(${(M)${(f)"$(ssh $args -a -x ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
 
@@ -262,7 +263,7 @@
       ;;
     file)
       if compset -P '*:'; then
-        _remote_files && ret=0
+        _remote_files ${(kv)opt_args[(I)-[P1246]]/-P/-p} && ret=0
       elif compset -P '*@'; then
         _wanted hosts expl host _ssh_hosts -S: && ret=0
       else

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.



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