From 190aef0e25ecb56bde977dfe75fdc84b4a12c7d4 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Mon, 4 Feb 2002 18:03:02 +0000 Subject: 16553: differentiate between files and directories during remote scp completion. --- Completion/Unix/Command/_ssh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_ssh') diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 7d1d95d7c..8830db6ee 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -3,11 +3,16 @@ _remote_files () { # This is extremely simple-minded; could parse "ls -F" output to do # colorings and LIST_TYPES and so on, but I'm just not that ambitious. - local expl + local expl remfiles if zstyle -T ":completion:${curcontext}:" remote-access; then + remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${words[CURRENT]#*:}\*)"}) + _wanted files expl 'remote files' \ - compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) + compadd ${${remfiles:#*/}/[*=@](#e)/} + + _wanted dirs expl 'remote directories' \ + compadd -S/ ${${(M)remfiles:#*/}/\\/(#e)/} else _message 'remote files' fi -- cgit 1.4.1