* scp completion
@ 2002-09-02 16:37 Thomas Köhler
2002-09-03 9:02 ` Oliver Kiddle
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Köhler @ 2002-09-02 16:37 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 986 bytes --]
Hi,
zsh's completion for scp lacks a feature :)
When I use scp, I can complete remote file names like this:
scp foo@bar:/some/path<TAB>
^^^^^ completes remote filenames
That doesn't work when I have to use "-P" to scp:
scp -P 2222 foo@bar:/some/path<TAB>
^^^^^ tries to complete remote
filenames via port 22 which
fails
Is there any chance that this feature will be implemented soon or
is someone already working on it? Or should I have a look into
this myself and send a patch (might take a while until I figured
out that _ssh mess)?
Bye,
Thomas
--
Thomas Köhler Email: jean-luc@picard.franken.de | LCARS - Linux
<>< WWW: http://jeanluc-picard.de | for Computers
IRC: jeanluc | on All Real
PGP public key available from Homepage! | Starships
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scp completion
2002-09-02 16:37 scp completion Thomas Köhler
@ 2002-09-03 9:02 ` Oliver Kiddle
2002-09-03 15:10 ` Thomas Köhler
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2002-09-03 9:02 UTC (permalink / raw)
To: Thomas Köhler; +Cc: Zsh hackers list
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scp completion
2002-09-03 9:02 ` Oliver Kiddle
@ 2002-09-03 15:10 ` Thomas Köhler
2002-09-03 15:20 ` Thomas Köhler
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Köhler @ 2002-09-03 15:10 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]
Hi,
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...
> Oliver
Ciao,
Thomas
--
Thomas Köhler Email: jean-luc@picard.franken.de | LCARS - Linux
<>< WWW: http://jeanluc-picard.de | for Computers
IRC: jeanluc | on All Real
PGP public key available from Homepage! | Starships
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scp completion
2002-09-03 15:10 ` Thomas Köhler
@ 2002-09-03 15:20 ` Thomas Köhler
2002-09-03 16:24 ` Oliver Kiddle
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Köhler @ 2002-09-03 15:20 UTC (permalink / raw)
To: Oliver Kiddle, Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]
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@picard.franken.de | LCARS - Linux
<>< WWW: http://jeanluc-picard.de | for Computers
IRC: jeanluc | on All Real
PGP public key available from Homepage! | Starships
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scp completion
2002-09-03 15:20 ` Thomas Köhler
@ 2002-09-03 16:24 ` Oliver Kiddle
0 siblings, 0 replies; 5+ messages in thread
From: Oliver Kiddle @ 2002-09-03 16:24 UTC (permalink / raw)
To: Thomas Köhler; +Cc: zsh-workers
On Tue, Sep 03, 2002 at 05:20:23PM +0200, Thomas Köhler wrote:
> + _remote_files ${(kv)opt_args[(I)-[FP1246]]/-P/-p} && ret=0
> 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?
For the above line, you need:
_remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0
The difference being the `~' before opt_args which turns on glob_subst
for the evaluation.
I'll commit the patch with this addition.
Oliver
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-09-04 8:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-02 16:37 scp completion Thomas Köhler
2002-09-03 9:02 ` Oliver Kiddle
2002-09-03 15:10 ` Thomas Köhler
2002-09-03 15:20 ` Thomas Köhler
2002-09-03 16:24 ` Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).