download-unicode-files.sh (1018B)
1 #!/bin/sh 2 3 set -e 4 data_files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt" 5 emoji_files="emoji-data.txt" 6 files="'$data_files $emoji_files'" 7 8 UNIDIR_DEFAULT=src/unicode 9 DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public' 10 11 if test "$1" = '--help' ; then 12 echo 'Usage:' 13 echo " $0[ TARGET_DIRECTORY[ URL_BASE]]" 14 echo 15 echo "Downloads files $files to TARGET_DIRECTORY." 16 echo "Each file is downloaded from URL_BASE/\$filename." 17 echo 18 echo "Default target directory is $PWD/${UNIDIR_DEFAULT}." 19 echo "Default URL base is ${DOWNLOAD_URL_BASE_DEFAULT}." 20 exit 0 21 fi 22 23 UNIDIR=${1:-$UNIDIR_DEFAULT} 24 DOWNLOAD_URL_BASE=${2:-$DOWNLOAD_URL_BASE_DEFAULT} 25 26 for filename in $data_files ; do 27 curl -L -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/$filename" 28 git -C "$UNIDIR" add "$filename" 29 done 30 31 for filename in $emoji_files ; do 32 curl -L -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/emoji/$filename" 33 git -C "$UNIDIR" add "$filename" 34 done 35 36 git -C "$UNIDIR" commit -m "feat: update unicode tables" .