mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
gotta-patch-em-all: Fix filename parsing
[why] The find predicate (e.g. -iname) and predicate parameter (the actual pattern) are in one variable and will be handed over to find as one parameter instead of two. How could this ever work? [how] Pass predicate mode and predicate parameter as two shell variables. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
fbe07b8abb
commit
e957f9f217
1 changed files with 7 additions and 4 deletions
|
@ -37,6 +37,7 @@ res1=$(date +%s)
|
||||||
parent_dir="${sd}/../../"
|
parent_dir="${sd}/../../"
|
||||||
# Set source and target directories
|
# Set source and target directories
|
||||||
source_fonts_dir="${sd}/../../src/unpatched-fonts"
|
source_fonts_dir="${sd}/../../src/unpatched-fonts"
|
||||||
|
like_mode=''
|
||||||
like_pattern=''
|
like_pattern=''
|
||||||
complete_variations_per_family=4
|
complete_variations_per_family=4
|
||||||
font_typefaces_count=0
|
font_typefaces_count=0
|
||||||
|
@ -53,10 +54,12 @@ if [ $# -eq 1 ] || [ "$1" != "" ]
|
||||||
then
|
then
|
||||||
if [[ "${1:0:1}" == "/" ]]
|
if [[ "${1:0:1}" == "/" ]]
|
||||||
then
|
then
|
||||||
like_pattern="-ipath \"*$1*/*.[o,t]tf\""
|
like_mode="-ipath"
|
||||||
|
like_pattern="*$1*/*.[o,t]tf"
|
||||||
echo "$LINE_PREFIX Parameter given, limiting search and patch to pathname pattern '$1' given"
|
echo "$LINE_PREFIX Parameter given, limiting search and patch to pathname pattern '$1' given"
|
||||||
else
|
else
|
||||||
like_pattern="-iname \"$1*.[o,t]tf\""
|
like_mode="-iname"
|
||||||
|
like_pattern="$1*.[o,t]tf"
|
||||||
echo "$LINE_PREFIX Parameter given, limiting search and patch to filename pattern '$1' given"
|
echo "$LINE_PREFIX Parameter given, limiting search and patch to filename pattern '$1' given"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -73,7 +76,7 @@ fi
|
||||||
source_fonts=()
|
source_fonts=()
|
||||||
while IFS= read -d $'\0' -r file ; do
|
while IFS= read -d $'\0' -r file ; do
|
||||||
source_fonts=("${source_fonts[@]}" "$file")
|
source_fonts=("${source_fonts[@]}" "$file")
|
||||||
done < <(find "$source_fonts_dir" ${like_pattern} -type f -print0)
|
done < <(find "$source_fonts_dir" ${like_mode} ${like_pattern} -type f -print0)
|
||||||
|
|
||||||
# print total number of source fonts found
|
# print total number of source fonts found
|
||||||
echo "$LINE_PREFIX Total source fonts found: ${#source_fonts[*]}"
|
echo "$LINE_PREFIX Total source fonts found: ${#source_fonts[*]}"
|
||||||
|
@ -292,7 +295,7 @@ then
|
||||||
# to follow font naming changed. We can not do this if we patch only
|
# to follow font naming changed. We can not do this if we patch only
|
||||||
# some of the source font files in that directory.
|
# some of the source font files in that directory.
|
||||||
last_source_dir=${current_source_dir}
|
last_source_dir=${current_source_dir}
|
||||||
num_to_patch=$(find "${current_source_dir}" -iname "${like_pattern}*.[o,t]tf" -type f | wc -l)
|
num_to_patch=$(find "${current_source_dir}" ${like_mode} ${like_pattern} -type f | wc -l)
|
||||||
num_existing=$(find "${current_source_dir}" -iname "*.[o,t]tf" -type f | wc -l)
|
num_existing=$(find "${current_source_dir}" -iname "*.[o,t]tf" -type f | wc -l)
|
||||||
if [ ${num_to_patch} -eq ${num_existing} ]
|
if [ ${num_to_patch} -eq ${num_existing} ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in a new issue