diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2015-06-02 00:41:20 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2015-06-02 00:41:20 +0200 |
commit | 752cbfd48ab774e3de0ecf49543fe748a03406df (patch) | |
tree | a78726bf01b008c9b60f84257210b45870da09dd /Functions | |
parent | 8b373331f539bedc68aa74b1fe0472151f1bea68 (diff) | |
parent | f0068edb4888a4d8fe94defa9c7affaa15e917c9 (diff) | |
download | zsh-752cbfd48ab774e3de0ecf49543fe748a03406df.tar.gz zsh-752cbfd48ab774e3de0ecf49543fe748a03406df.zip |
New upstream release: Merge tag 'zsh-5.0.8' / branch 'upstream' into 'debian'.
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Zftp/zfget_match | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Functions/Zftp/zfget_match b/Functions/Zftp/zfget_match index 3a33c9886..a440cace1 100644 --- a/Functions/Zftp/zfget_match +++ b/Functions/Zftp/zfget_match @@ -9,17 +9,31 @@ if [[ $1 == $HOME || $1 == $HOME/* ]]; then fi if [[ $ZFTP_SYSTEM == UNIX* && $1 == */* ]]; then - setopt localoptions clobber + setopt localoptions clobber extendedglob local tmpf=${TMPPREFIX}zfgm$$ zf_ln -fn =(<<<'') $tmpf || return 1 if [[ -n $WIDGET ]]; then - local dir=${1:h} + local dir=${1%/*} [[ $dir = */ ]] || dir="$dir/" zftp ls -LF $dir >$tmpf - local reply - reply=(${${${(f)"$(<$tmpf)"}##$dir}%\*}) - _wanted files expl 'remote file' compadd -P $dir - $reply + local reply1 reply2 + + # dirs in reply1, files in reply2 + reply1=(${${(M)${${(f)"$(<$tmpf)"}##$dir}:#*/}%/}) + reply2=(${${${${(f)"$(<$tmpf)"}##$dir}%\*}:#*/}) + + # try dir if ls -F doesn't work + if ! (($#reply1)); then + zftp dir $dir >$tmpf + reply1=(${(M)${(f)"$(<$tmpf)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##}) + reply1=(${reply1/(#b)d([^[:space:]]##[[:space:]]##)(#c8)([^\/]##)\/#/$match[2]}) + + reply2=(${${(f)"$(<$tmpf)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##}) + reply2=(${reply2/(#b)([^[:space:]]##[[:space:]]##)(#c8)(?##)/$match[2]}) + fi + _wanted directories expl 'remote directory' compadd -S/ -q -P $dir - $reply1 + _wanted files expl 'remote file' compadd -P $dir - $reply2 else # On the first argument to ls, we usually get away with a glob. zftp ls "$1*$2" >$tmpf |