Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: completing remote files for scp
- X-seq: zsh-workers 16864
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: completing remote files for scp
- Date: Tue, 19 Mar 2002 17:22:45 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: Oliver Kiddle <kiddleo@xxxxxxxxxx>
As far as I could tell, completion of files for scp only worked with
full filenames starting from root. More often than not, I want to
copy files from my home on the remote system so I use no initial
slash. Trying to do this, I first get `./' inserted and then can't
complete in subdirectories.
I think this patch is right now. I find it all a bit easier by
using compadd -P/-S. I've also changed the consecutive calls to
_wanted with the same tag which isn't particularly efficient.
Some of this can probably be transferred over to _rsync.
Oliver
Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.9
diff -u -r1.9 _ssh
--- Completion/Unix/Command/_ssh 5 Feb 2002 18:10:54 -0000 1.9
+++ Completion/Unix/Command/_ssh 19 Mar 2002 17:12:01 -0000
@@ -2,21 +2,28 @@
_remote_files () {
# There should be coloring based on all the different ls -F classifiers.
- local expl remfiles remdispf remdispd
+ local expl remfiles remdispf remdispd suf ret=1
if zstyle -T ":completion:${curcontext}:" remote-access; then
- remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${${${words[CURRENT]#*:}:h}/\\/(#e)/}/\* 2>/dev/null)"})
+ remfiles=(${(M)${(f)"$(ssh -a -x ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^/]#}\* 2>/dev/null)"}%%[^/]##(|/)})
+ compset -P '*/'
+ compset -S '/*' || suf='remote file'
remdispf=(${remfiles:#*/})
remdispd=(${(M)remfiles:#*/})
- _wanted files expl 'remote files and directories' \
- compadd -d remdispf ${${remfiles:#*/}/[*=@|](#e)/}
-
- _wanted files expl 'remote files and directories' \
- compadd -S/ -d remdispd ${${(M)remfiles:#*/}/\\/(#e)/}
+ _tags files
+ while _tags; do
+ while _next_label files expl ${suf:-remote directory}; do
+ [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \
+ ${remdispf%[*=@|]} && ret=0
+ compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
+ ${remdispd%/} && ret=0
+ done
+ (( ret )) || return 0
+ done
else
- _message 'remote files'
+ _message 'remote file'
fi
}
--
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author