* PATCH: completing remote files for scp
@ 2002-03-19 17:22 Oliver Kiddle
0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2002-03-19 17:22 UTC (permalink / raw)
To: zsh-workers
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-03-19 17:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-19 17:22 PATCH: completing remote files for scp 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).