blob: c2871fa16f8c14822af6a080293a4dbb87aba0a6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# function zfget_match {
emulate -L zsh
# the zfcd hack: this may not be necessary here
if [[ $1 == $HOME || $1 == $HOME/* ]]; then
1="~${1#$HOME}"
fi
if [[ $ZFTP_SYSTEM == UNIX* && $1 == */* ]]; then
setopt localoptions clobber
local tmpf=${TMPPREFIX}zfgm$$
mv -f =(:) $tmpf
if [[ -n $WIDGET ]]; then
local dir=${1:h}
[[ $dir = */ ]] || dir="$dir/"
zftp ls -LF $dir >$tmpf
local reply
reply=(${${${(f)"$(<$tmpf)"}##$dir}%\*})
_wanted files expl 'remote file' compadd -P $dir - $reply
else
# On the first argument to ls, we usually get away with a glob.
zftp ls "$1*$2" >$tmpf
reply=($(<$tmpf))
fi
else
local fcache_name
zffcache
if [[ -n $WIDGET ]]; then
_wanted files expl 'remote file' compadd -F fignore - ${(P)fcache_name}
else
reply=(${(P)fcache_name});
fi
fi
# }
|