summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-03-19 17:28:20 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-03-19 17:28:20 +0000
commit79952b8e056010e552b44751fd0716447e0153b6 (patch)
treed6935c1088a67dfc804b0ba6dfcf8b9714e84ae6
parent40c30874616c374f207ce79b98f8dd61a3911784 (diff)
downloadzsh-79952b8e056010e552b44751fd0716447e0153b6.tar.gz
zsh-79952b8e056010e552b44751fd0716447e0153b6.zip
16864: fix remote file completion with relative paths
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_ssh23
2 files changed, 18 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index e4ae4325b..defbbaeaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2002-03-19 Oliver Kiddle <opk@zsh.org>
+ * 16864: Completion/Unix/Command/ssh: fix remote file completion
+ with relative paths
+
* unposted: Completion/Unix/Command/_grep: argument to -C must
be in the same word and correct mistake on file completion
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 672031c36..012fec552 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -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
}