mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-12-13 17:18:37 +02:00
50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Nerd Fonts Version: 2.0.0
|
|
# Script Version: 1.1.0
|
|
# Iterates over all patched fonts directories
|
|
# to generate ruby cask files for homebrew-fonts (https://github.com/caskroom/homebrew-fonts)
|
|
# adds Windows versions of the fonts as well (casks files just won't download them)
|
|
|
|
#set -x
|
|
|
|
LINE_PREFIX="# [Nerd Fonts] "
|
|
scripts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/"
|
|
echo "dir $scripts_root_dir"
|
|
outputdir=$scripts_root_dir/../../archives/
|
|
|
|
cd "$scripts_root_dir/../../patched-fonts/" || {
|
|
echo >&2 "$LINE_PREFIX Could not find patched fonts directory"
|
|
exit 1
|
|
}
|
|
|
|
# limit archiving to given pattern (first script param) or entire root folder if no param given:
|
|
if [ $# -eq 1 ]
|
|
then
|
|
pattern="$1"
|
|
search_pattern="*$1*.zip"
|
|
echo "$LINE_PREFIX Limiting archive to pattern '$pattern'"
|
|
else
|
|
pattern="."
|
|
search_pattern="*.zip"
|
|
echo "$LINE_PREFIX No limting pattern given, will search entire folder"
|
|
fi
|
|
|
|
# clear out the directory zips
|
|
find "${outputdir:?}" -name "$search_pattern" -type f -delete
|
|
|
|
#find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font
|
|
#find ./ProFont -maxdepth 0 -type d | # uncomment to test 1 font
|
|
find "./$pattern" -maxdepth 0 -type d | # uncomment to test all fonts
|
|
while read -r filename
|
|
do
|
|
|
|
basename=$(basename "$filename")
|
|
searchdir=$filename
|
|
|
|
[[ -d "$outputdir" ]] || mkdir -p "$outputdir"
|
|
|
|
# -ic (ignore case not working)
|
|
zip "$outputdir/$basename" -rj "$searchdir" -i '*.[o,t]tf' -i '*.[O,T]TF'
|
|
|
|
done
|