1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-14 05:41:31 +02:00
zsh/Functions/MIME/zsh-mime-contexts
Peter Stephenson 6e29de366c Missed file.
2011-11-20 16:05:12 +00:00

24 lines
491 B
Text

# Helper for zsh-mime-handler.
#
# Pass in a zstyle option, a suffix, which might include multiple parts
# (e.g. pdf.gz), plus remaining zstyle arguments plus arguments to zstyle.
# Try to match the style starting with the longest possible suffix.
local context suffix option
option=$1
shift
suffix=$1
shift
while true; do
context=":mime:.${suffix}:"
zstyle $option $context "$@" && return 0
if [[ $suffix = *.* ]]; then
suffix=${suffix#*.}
else
break
fi
done
return 1