1999-04-25 17:43:45 +02:00
|
|
|
# function zfcd_match {
|
|
|
|
|
|
|
|
emulate -L zsh
|
|
|
|
|
|
|
|
# see zfcd for details of this hack
|
|
|
|
if [[ $1 = $HOME || $1 = $HOME/* ]]; then
|
|
|
|
1="~${1#$HOME}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# error messages only
|
|
|
|
local ZFTP_VERBOSE=45
|
|
|
|
# should we redirect 2>/dev/null or let the user see it?
|
|
|
|
|
|
|
|
local tmpf=${TMPPREFIX}zfcm$$
|
|
|
|
|
|
|
|
if [[ $ZFTP_SYSTEM = UNIX* ]]; then
|
|
|
|
# hoo, aren't we lucky: this makes things so much easier
|
2000-04-01 22:49:47 +02:00
|
|
|
setopt rcexpandparam
|
1999-04-25 17:43:45 +02:00
|
|
|
local dir
|
|
|
|
if [[ $1 = ?*/* ]]; then
|
|
|
|
dir=${1%/*}
|
|
|
|
elif [[ $1 = /* ]]; then
|
|
|
|
dir=/
|
|
|
|
fi
|
|
|
|
# If we're using -F, we get away with using a directory
|
|
|
|
# to list, but not a glob. Don't ask me why.
|
|
|
|
# I hate having to rely on awk here.
|
2000-04-01 22:49:47 +02:00
|
|
|
zftp ls -LF $dir >$tmpf
|
2000-04-04 21:34:26 +02:00
|
|
|
reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $tmpf))
|
1999-04-25 17:43:45 +02:00
|
|
|
rm -f $tmpf
|
2000-04-01 22:49:47 +02:00
|
|
|
[[ -n $dir && $dir != */ ]] && dir="$dir/"
|
|
|
|
if [[ -n $WIDGET ]]; then
|
2000-05-03 09:34:50 +02:00
|
|
|
_wanted directories expl 'remote directory' \
|
2000-04-01 22:49:47 +02:00
|
|
|
compadd -S/ -q -P "$dir" - $reply
|
1999-04-25 17:43:45 +02:00
|
|
|
elif [[ -n $dir ]]; then
|
2000-04-01 22:49:47 +02:00
|
|
|
reply=(${dir}$reply)
|
1999-04-25 17:43:45 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
# I simply don't know what to do here.
|
|
|
|
# Just use the list of files for the current directory.
|
|
|
|
zfget_match $*
|
|
|
|
fi
|
|
|
|
|
|
|
|
# }
|