From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5528 invoked from network); 4 Feb 2002 17:59:42 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 4 Feb 2002 17:59:42 -0000 Received: (qmail 23906 invoked by alias); 4 Feb 2002 17:59:34 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16553 Received: (qmail 23892 invoked from network); 4 Feb 2002 17:59:32 -0000 Date: Mon, 4 Feb 2002 12:59:27 -0500 From: Clint Adams To: zsh-workers@sunsite.dk Cc: david@debian.org Subject: PATCH: _ssh (scp) Message-ID: <20020204175927.GA12977@dman.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i So this is based on a patch from David Engel for something resembling the current 4.0.x CVS. Is it necessary to provide the echo behavior as well, or can we safely assume that everything can do ls -d1F these days? Index: Completion/Unix/Command/_ssh =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v retrieving revision 1.5 diff -u -r1.5 _ssh --- Completion/Unix/Command/_ssh 2002/01/16 16:29:52 1.5 +++ Completion/Unix/Command/_ssh 2002/02/04 17:25:18 @@ -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