ensure font-patcher options are handled correctly by docker entry point

This commit is contained in:
dgswilkins 2021-05-15 09:51:59 -07:00
parent 24a562c5fe
commit 68ef18e8f4

View file

@ -1,19 +1,25 @@
#!/bin/sh
skip=false
args=""
# Discard --out option
for i; do
[ "${i}" != "${i% *}" ] && i="\"$i\""
if [ "$i" = "--out" ] || [ "$i" = "-o" ]; then
skip=true
else
if [ "$skip" = false ] || [ "$i" == "-*" ]; then
args="$args $i"
fi
skip=false
fi
# check all args for --out or -o
while [ "$#" -gt 0 ]; do
if [ "$1" = "-out" ] || [ "$1" = "--outputdir" ];then
# move past the option
shift
# and the value if there is one
case "$1" in
-*) continue ;;
*) shift $(( $# > 0 ? 1 : 0 )) ;;
esac
continue
fi
args="$args $1"
shift
done
for f in /in/*.otf /in/*.ttf /in/*.woff /in/*.eot; do [ -f $f ] && fontforge -script /nerd/font-patcher -out /out $args $f; done
printf "Running with options:\n%s\n" "$args"
# shellcheck disable=SC2086
for f in /in/*.otf /in/*.ttf /in/*.woff /in/*.eot; do [ -f "$f" ] && fontforge -script ~/nerd-fonts/font-patcher -out /out $args $f; done