2015-03-15 11:28:38 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
2016-09-21 07:15:19 -07:00
|
|
|
data_files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt"
|
|
|
|
emoji_files="emoji-data.txt"
|
2022-10-30 05:50:41 -07:00
|
|
|
files="'$data_files $emoji_files'"
|
2015-03-15 11:28:38 -07:00
|
|
|
|
2022-06-27 12:30:27 -07:00
|
|
|
UNIDIR_DEFAULT=src/unicode
|
2016-09-21 07:15:19 -07:00
|
|
|
DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public'
|
2015-03-15 11:28:38 -07:00
|
|
|
|
2022-10-30 05:50:41 -07:00
|
|
|
if test "$1" = '--help' ; then
|
2015-03-15 11:28:38 -07:00
|
|
|
echo 'Usage:'
|
|
|
|
echo " $0[ TARGET_DIRECTORY[ URL_BASE]]"
|
|
|
|
echo
|
|
|
|
echo "Downloads files $files to TARGET_DIRECTORY."
|
|
|
|
echo "Each file is downloaded from URL_BASE/\$filename."
|
|
|
|
echo
|
|
|
|
echo "Default target directory is $PWD/${UNIDIR_DEFAULT}."
|
|
|
|
echo "Default URL base is ${DOWNLOAD_URL_BASE_DEFAULT}."
|
2022-10-30 05:50:41 -07:00
|
|
|
exit 0
|
2015-03-15 11:28:38 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
UNIDIR=${1:-$UNIDIR_DEFAULT}
|
|
|
|
DOWNLOAD_URL_BASE=${2:-$DOWNLOAD_URL_BASE_DEFAULT}
|
|
|
|
|
2016-09-21 07:15:19 -07:00
|
|
|
for filename in $data_files ; do
|
2017-06-29 14:44:47 -07:00
|
|
|
curl -L -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/$filename"
|
2022-10-30 05:50:41 -07:00
|
|
|
git -C "$UNIDIR" add "$filename"
|
2016-09-21 07:15:19 -07:00
|
|
|
done
|
|
|
|
|
|
|
|
for filename in $emoji_files ; do
|
2020-10-04 08:50:29 -07:00
|
|
|
curl -L -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/emoji/$filename"
|
2022-12-28 14:50:24 -07:00
|
|
|
git -C "$UNIDIR" add "$filename"
|
2015-03-15 11:28:38 -07:00
|
|
|
done
|
|
|
|
|
2022-10-30 05:50:41 -07:00
|
|
|
git -C "$UNIDIR" commit -m "feat: update unicode tables" .
|