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

[PATCH 2/4] _rsync: fix rsync remote file completion (ALT#12958).



rsync shows exactly five fields, separated by one or more spaces:

attributes    size date time file or directory name

In this example "file or directory name" should be completed, so exactly
four fileds should be stripped out.

Signed-off-by: Alexey I. Froloff <raorn@xxxxxxxxxxxx>
---
 Completion/Unix/Command/_rsync |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index 34d4260..c26c05f 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -31,11 +31,14 @@ if compset -P '*::*/' || compset -P 'rsync://*/*/'; then
   remdispf=(${remfiles:#d*})
   remdispd=(${(M)remfiles:#d*})
 
+  # $remdisp[fd] format:
+  # attrs  size  date  time  name
+
   _wanted files expl 'remote file or directory' \
-      compadd -d remdispf ${remdispf##* }
+      compadd -d remdispf ${${${${remdispf##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}
 
   _wanted files expl 'remote file or directory' \
-      compadd -S/ -d remdispd ${remdispd##* }
+      compadd -S/ -d remdispd ${${${${remdispd##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}
 
 elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then
 
-- 
1.6.1.3.GIT



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