From 3a223ceeea2a320f8532807ab58b07b7baa05e1f Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Fri, 8 Feb 2002 08:37:31 +0000 Subject: 16566, 16568, 16461: improvements for scp completion. --- ChangeLog | 7 +++++-- Completion/Unix/Command/_ssh | 21 ++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7bb4c9151..94a084cd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ 2002-02-08 Clint Adams - * Matt Zimmerman: 16590: Completion/Unix/Type/_dict_words: - use a prefix match instead of a "fuzzy-exact" match. + * 16566, 16568, Oliver: 16461: Completion/Unix/Command/_ssh: + improvements for scp completion. + + * Matt Zimmerman: 16590: Completion/Unix/Type/_dict_words: + use a prefix match instead of a "fuzzy-exact" match. 2002-02-07 Clint Adams diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 40664114c..672031c36 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -1,12 +1,23 @@ #compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen _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 + # There should be coloring based on all the different ls -F classifiers. + local expl remfiles remdispf remdispd - _wanted files expl 'remote files' \ - compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) + if zstyle -T ":completion:${curcontext}:" remote-access; then + remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${${${words[CURRENT]#*:}:h}/\\/(#e)/}/\* 2>/dev/null)"}) + + 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)/} + else + _message 'remote files' + fi } _ssh () { -- cgit 1.4.1