mirror of
https://git.code.sf.net/p/zsh/code
synced 2026-04-19 15:33:34 -04:00
32 lines
613 B
Plaintext
32 lines
613 B
Plaintext
# function zftype {
|
|
local type zftmp=${TMPPREFIX}zftype$$
|
|
[[ $curcontext = :zf* ]] || local curcontext=:zftype
|
|
|
|
zfautocheck -d
|
|
|
|
if (( $# == 0 )); then
|
|
zftp type >$zftmp
|
|
type=$(<$zftmp)
|
|
rm -f $zftmp
|
|
if [[ $type = I ]]; then
|
|
print "Current type is image (binary)"
|
|
return 0
|
|
elif [[ $type = A ]]; then
|
|
print "Current type is ASCII"
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
else
|
|
if [[ $1 == (#i)a(sc(ii|)|) ]]; then
|
|
type=A
|
|
elif [[ $1 == (#i)i(m(age|)|) || $1 == (#i)b(in(ary|)|) ]]; then
|
|
type=I
|
|
else
|
|
print "Type not recognised: $1" 2>&1
|
|
return 1
|
|
fi
|
|
zftp type $type
|
|
fi
|
|
# }
|