From d374f2b1800d54d37a8e4c5299e824874a0489ed Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 9 Dec 2011 22:39:08 +0000 Subject: 29918: Completion: Add new _remote_files() helper and use it to reduce code duplication. --- Completion/Unix/Command/_rlogin | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'Completion/Unix/Command/_rlogin') diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin index 0d8355bfb..a04c6d068 100644 --- a/Completion/Unix/Command/_rlogin +++ b/Completion/Unix/Command/_rlogin @@ -1,32 +1,5 @@ #compdef rlogin rsh remsh=rsh rcp -_rcp_remote_files () { - # There should be coloring based on all the different ls -F classifiers. - local expl remfiles remdispf remdispd suf ret=1 - - if zstyle -T ":completion:${curcontext}:" remote-access; then - remfiles=(${(M)${(f)"$(rsh ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - else - _message -e remote-files 'remote file' - fi -} - _rlogin () { case "$service" in rlogin) @@ -65,7 +38,7 @@ _rlogin () { if [[ -n "$state" ]]; then if compset -P '*:'; then - _rcp_remote_files && ret=0 + _remote_files -- rsh && ret=0 elif compset -P '*@'; then _wanted hosts expl host _rlogin_hosts -S: && ret=0 else -- cgit 1.4.1