zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] scp distinguish local file from remote file
@ 2013-03-19  9:33 Han Pingtian
  2013-03-19 20:59 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Han Pingtian @ 2013-03-19  9:33 UTC (permalink / raw)
  To: zsh-workers

If a file path starting with a '.' or '/', then it should be a local
file/dir, even if there are colons in the path. This will try to fix
this problem:

➜aimlp7 ~ ☻ ls /var/crash/biglp9/10.33.5.227-2013.03.19-04:21:30
vmcore.flat
➜aimlp7 ~ ☻ scp /var/crash/biglp9/10.33.5.227-2013.03.19-04:21:30<tab>
No matches: `file', `option', `remote file', or `corrections'
---
 Completion/Unix/Command/_ssh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 7e85e2b..8711b6b 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -519,7 +519,7 @@ _ssh () {
       fi
       ;;
     file)
-      if compset -P '*:'; then
+      if compset -P '[^./]*:'; then
         _remote_files -- ssh ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0
       elif compset -P '*@'; then
         suf=( -S '' )
-- 
1.7.7.6


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

* Re: [PATCH] scp distinguish local file from remote file
  2013-03-19  9:33 [PATCH] scp distinguish local file from remote file Han Pingtian
@ 2013-03-19 20:59 ` Peter Stephenson
  2013-03-20  5:36   ` Han Pingtian
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2013-03-19 20:59 UTC (permalink / raw)
  To: zsh-workers

On Tue, 19 Mar 2013 17:33:59 +0800
Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> If a file path starting with a '.' or '/', then it should be a local
> file/dir, even if there are colons in the path. 

Right.  In fact, any slash before the colon should have that effect,
shouldn't it?

> -      if compset -P '*:'; then
> +      if compset -P '[^./]*:'; then

So maybe the pattern could be '[^./][^/]#:'?

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

* Re: [PATCH] scp distinguish local file from remote file
  2013-03-19 20:59 ` Peter Stephenson
@ 2013-03-20  5:36   ` Han Pingtian
  0 siblings, 0 replies; 3+ messages in thread
From: Han Pingtian @ 2013-03-20  5:36 UTC (permalink / raw)
  To: zsh-workers

On Tue, Mar 19, 2013 at 08:59:39PM +0000, Peter Stephenson wrote:
> On Tue, 19 Mar 2013 17:33:59 +0800
> Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> > If a file path starting with a '.' or '/', then it should be a local
> > file/dir, even if there are colons in the path. 
> 
> Right.  In fact, any slash before the colon should have that effect,
> shouldn't it?
> 
> > -      if compset -P '*:'; then
> > +      if compset -P '[^./]*:'; then
> 
> So maybe the pattern could be '[^./][^/]#:'?
> 
Yeah, it is true. Thanks for the correction. 


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

end of thread, other threads:[~2013-03-20  5:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19  9:33 [PATCH] scp distinguish local file from remote file Han Pingtian
2013-03-19 20:59 ` Peter Stephenson
2013-03-20  5:36   ` Han Pingtian

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).