zsh-users
 help / color / mirror / code / Atom feed
* remote files completion for scp
@ 2003-05-06 21:34 Michał Politowski
  2003-05-07 10:15 ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Politowski @ 2003-05-06 21:34 UTC (permalink / raw)
  To: zsh-users

I believe that this completion needs something, maybe dequoting like this, to work correctly.
Without this it can't complete any remote path segments after one with
spaces, with the change it works for me.

--- /usr/share/zsh/4.0.6/functions/Completion/Unix/_ssh	2003-03-25 15:45:53.000000000 +0100
+++ /home/mike/.zsh/functions/_ssh	2003-05-06 23:18:03.000000000 +0200
@@ -7,5 +7,5 @@
   if zstyle -T ":completion:${curcontext}:" remote-access; then
     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)"}%%[^/]#(|/)})
+    remfiles=(${(M)${(f)"$(ssh $args -a -x ${words[CURRENT]%%:*} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'



One other thing. I obviously don't understand something about quoting.
Why with foo='a\string\with\some\backslashes'
echo "${foo//'\'/-}"
and
echo "${foo//"\\"/-}"
work but
echo "${foo//\\/-}"
doesn't do any substitutions,
no matter how many backslashes do I actually put in the last one?

-- 
Michał Politowski -- mpol@charybda.icm.edu.pl
Warning: this is a memetically modified message


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: remote files completion for scp
  2003-05-06 21:34 remote files completion for scp Michał Politowski
@ 2003-05-07 10:15 ` Oliver Kiddle
  2003-05-07 11:40   ` Michał Politowski
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2003-05-07 10:15 UTC (permalink / raw)
  To: Michał Politowski; +Cc: zsh-users

=?iso-8859-2?Q?Micha=B3?= Politowski wrote:

> I believe that this completion needs something, maybe dequoting like this, to work correctly.
> Without this it can't complete any remote path segments after one with
> spaces, with the change it works for me.

Thanks. Unless I've misunderstood you, this has already been fixed
(in both branches on CVS). You might want to check them though as I
seem the remember the fix as being adding a second level of quoting and
not dequoting.

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: remote files completion for scp
  2003-05-07 10:15 ` Oliver Kiddle
@ 2003-05-07 11:40   ` Michał Politowski
  2003-05-07 12:37     ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Politowski @ 2003-05-07 11:40 UTC (permalink / raw)
  To: zsh-users

On Wed,  7 May 2003 12:15:23 +0200, Oliver Kiddle wrote:
> =?iso-8859-2?Q?Micha=B3?= Politowski wrote:
> 
> > I believe that this completion needs something, maybe dequoting like this, to work correctly.
> > Without this it can't complete any remote path segments after one with
> > spaces, with the change it works for me.
> 
> Thanks. Unless I've misunderstood you, this has already been fixed
> (in both branches on CVS). You might want to check them though as I
> seem the remember the fix as being adding a second level of quoting and
> not dequoting.

This is not the same problem.
If I understand things correctly the second-level-of-quoting fix
was meant to produce correct command lines for scp,
and I have this version installed.

But it seems that with this additional quoting of completion results
should go equivalent dequoting when they are used again as the base
for next completions.
The (Q) addition isn't much more than a guess, but Works For Me.

And another deficiency I've just noticed:
scp 'hostname:<TAB>
(note the opening quote) fails to produce any matches.
But for solving this I definitely don't feel qualified.

-- 
Michał Politowski -- mpol@charybda.icm.edu.pl
Warning: this is a memetically modified message


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: remote files completion for scp
  2003-05-07 11:40   ` Michał Politowski
@ 2003-05-07 12:37     ` Oliver Kiddle
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2003-05-07 12:37 UTC (permalink / raw)
  To: Michał Politowski; +Cc: zsh-users

=?iso-8859-2?Q?Micha=B3?= Politowski wrote:
> 
> This is not the same problem.
> If I understand things correctly the second-level-of-quoting fix
> was meant to produce correct command lines for scp,
> and I have this version installed.

Yes, sorry you're right. Your fix is the correct one and I'll apply
it. The added quoting gets in the way when doing the remote ls.

> And another deficiency I've just noticed:
> scp 'hostname:<TAB>
> (note the opening quote) fails to produce any matches.
> But for solving this I definitely don't feel qualified.

This problem probably applies in other cases - the words array includes
any quoting and that needs removing (which isn't as easy as you might
think). For this I'll just make it use IPREFIX which works for single
and double quotes but not for backslashes. Patch below does this.

Oliver

Index: Completion/Unix/Command/_rlogin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rlogin,v
retrieving revision 1.2
diff -u -r1.2 _rlogin
--- Completion/Unix/Command/_rlogin	7 Jan 2003 08:51:10 -0000	1.2
+++ Completion/Unix/Command/_rlogin	7 May 2003 12:28:46 -0000
@@ -5,7 +5,7 @@
   local expl remfiles remdispf remdispd suf ret=1
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
-    remfiles=(${(M)${(f)"$(rsh ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
+    remfiles=(${(M)${(f)"$(rsh ${IPREFIX%:} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
 
Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.19
diff -u -r1.19 _ssh
--- Completion/Unix/Command/_ssh	13 Feb 2003 16:15:29 -0000	1.19
+++ Completion/Unix/Command/_ssh	7 May 2003 12:28:46 -0000
@@ -6,7 +6,7 @@
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
     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)"}%%[^/]#(|/)})
+    remfiles=(${(M)${(f)"$(ssh $args -a -x ${IPREFIX%:} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-07 12:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-06 21:34 remote files completion for scp Michał Politowski
2003-05-07 10:15 ` Oliver Kiddle
2003-05-07 11:40   ` Michał Politowski
2003-05-07 12:37     ` 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).