aboutsummaryrefslogtreecommitdiff
path: root/Functions/Zftp/zfget_match
blob: 677108edef3cde8d06556d738f5c8052fa43c99f (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
# 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

local tmpf=${TMPPREFIX}zfgm$$

if [[ $ZFTP_SYSTEM == UNIX* && $1 == */* ]]; then
  # On the first argument to ls, we usually get away with a glob.
  zftp ls "$1*$2" >$tmpf
  reply=($(<$tmpf))
  rm -f $tmpf
else
  if (( $#zftp_fcache == 0 )); then
    # Always cache the current directory and use it
    # even if the system is UNIX.
    zftp ls >$tmpf
    zftp_fcache=($(<$tmpf))
    rm -f $tmpf
  fi
  reply=($zftp_fcache);
fi
# }