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

Re: [PATCH] _rsync - better rsync:// URL support and other fixes



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 29 March 2005 15:00, Oliver Kiddle wrote:
> On 27 Mar, Andrey wrote:
> > Absolutely ugly "compadd -S/ rsync:/" is the only way I know to add word
> > with two slashes without adding blank. Oliver, do you have any idea (the
> > same problem I had in _urpmi too).
>
> It is possible to do:
>   compadd -S '' rsync://
>
> Or is there some problem with that?
>

No. Thank you.

The patch also fixes modules completion (broken in my last patch), stripes yet 
another MOTD (this starts to be amusing) and turns off rsync warnings.

- -andrey

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCT9StR6LMutpd94wRAkoAAJ9iPfU56lLxnzD7sf/PYI//QDMDyACePDzU
tMs/ttJxgosyiOkUOTLbgBM=
=nDnr
-----END PGP SIGNATURE-----
Index: Completion/Unix/Command/_rsync
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rsync,v
retrieving revision 1.21
diff -u -p -r1.21 _rsync
--- Completion/Unix/Command/_rsync	28 Mar 2005 21:02:06 -0000	1.21
+++ Completion/Unix/Command/_rsync	3 Apr 2005 11:30:35 -0000
@@ -13,7 +13,7 @@ _rsync_user_or_host() {
       _wanted users expl "user" \
 	  _combination -s '[:@]' "${tag}" users-hosts users -q "$@" -
   else
-    [[ $words[CURRENT] = rsync://* ]] || rsync='rsync:rsync: compadd -S/ rsync:/'
+    [[ $words[CURRENT] = rsync://* ]] || rsync='rsync:rsync: compadd -S "" rsync://'
     _alternative \
       'users:user:_users -S @' \
       "hosts:host:_hosts -S '$suf'" \
@@ -26,7 +26,7 @@ local expl remfiles remdispf remdispd re
 
 if compset -P '*::*/' || compset -P 'rsync://*/*/'; then
 
-  remfiles=(${${(f)"$(_call_program files rsync ${words[CURRENT]%/*}/)"}:#[ 	]*})
+  remfiles=(${${(f)"$(_call_program files rsync ${words[CURRENT]%/*}/ 2>/dev/null)"}:#([ 	]|MOTD:)*})
 
   remdispf=(${remfiles:#d*})
   remdispd=(${(M)remfiles:#d*})
@@ -41,11 +41,13 @@ elif compset -P 1 '*::' || compset -P 1 
 
   local pat=${words[CURRENT]}
 
-  if [[ $pat = *:: ]]; then
+  if [[ $pat = *::* ]]; then
     pat=${pat%::*}::
+  else
+    pat=${pat%/*}/
   fi
 
-  remfiles=(${${(f)"$(_call_program files rsync $pat)"}:#[ 	]*})
+  remfiles=(${${(f)"$(_call_program files rsync $pat 2>/dev/null)"}:#([ 	]|MOTD:)*})
 
   remmodules=(${remfiles/[ 	]##/:})
 


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