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

Re: scp completion



Hi,

Thomas Köhler wrote [2002/09/03 17:10]:
> Oliver Kiddle wrote [2002/09/03 11:11]:
> > 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.
> 
> Uhm, yes. I need also -F :-)
> 
> Tried to add that one, but somehow it didn't work. Can't have a
> look at that one now, will have to wait until later...

Oh well, one quick idea showed what's wrong. I used the following
patch on top of Oliver's:

-----------------------------
~/zsh/functions> diff -u _ssh\~ _ssh
--- _ssh~       2002-09-03 14:45:38.000000000 +0200
+++ _ssh        2002-09-03 17:15:37.000000000 +0200
@@ -5,7 +5,7 @@
   local expl remfiles remdispf remdispd args suf ret=1
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
-    zparseopts -D -E -a args p: 1 2 4 6
+    zparseopts -D -E -a args p: 1 2 4 6 F:
     remfiles=(${(M)${(f)"$(ssh $args -a -x ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
@@ -263,7 +263,7 @@
       ;;
     file)
       if compset -P '*:'; then
-        _remote_files ${(kv)opt_args[(I)-[P1246]]/-P/-p} && ret=0
+        _remote_files ${(kv)opt_args[(I)-[FP1246]]/-P/-p} && ret=0
       elif compset -P '*@'; then
         _wanted hosts expl host _ssh_hosts -S: && ret=0
       else
-----------------------------

Now - scp completion didn't work for me - until I used

   scp -F /home/jean-luc/.ssh/config.special -P 2222 tkoehler@localhost:

instead of

   scp -F ~/.ssh/config.special -P 2222 tkoehler@localhost:

How can I avoid the "~" problem?

Ciao,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@xxxxxxxxxxxxxxxxx     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

Attachment: pgpJdT2o1iMbe.pgp
Description: PGP signature



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