1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-10-30 23:43:47 +02:00

install.sh: Reintruduce extension parameter

[why]
At the moment we have every font only in one format (ttf or otf), so the
preference option does not do much (does not do anything).

Anyhow, it was there before and maybe at some point we take the multiple
formats up again, and then we are prepared.

[how]
Instead of the previous solution to search for all formats and then try
to remove the duplicates we search first for the desired format and if
we find not one font we search for the other format. This is slightly
different but the outcome is the same.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow
2025-05-08 13:36:07 +02:00
parent 13cb21c4a5
commit 0cbf18224c

View File

@@ -1,13 +1,14 @@
#!/usr/bin/env bash
# Install Nerd Fonts
__ScriptVersion="0.9"
__ScriptVersion="1.0"
# Default values for option variables:
quiet=false
mode="copy"
clean=false
dry=false
extension="otf"
extension1="otf"
extension2="ttf"
variant="R"
installpath="user"
@@ -68,8 +69,8 @@ while getopts "$optspec" optchar; do
C) clean=true;;
s) variant="M";;
p) variant="P";;
O) extension="otf";;
T) extension="ttf";;
O) extension1="otf"; extension2="ttf";;
T) extension1="ttf"; extension2="otf";;
S) installpath="system";;
U) installpath="user";;
@@ -87,8 +88,8 @@ while getopts "$optspec" optchar; do
clean) clean=true;;
mono) variant="M";;
use-proportional-glyphs) variant="P";;
otf) extension="otf";;
ttf) extension="ttf";;
otf) extension1="otf"; extension2="ttf";;
ttf) extension1="ttf"; extension2="otf";;
install-to-system-path) installpath="system";;
install-to-user-path) installpath="user";;
*)
@@ -147,7 +148,11 @@ collect_files() {
# Find all the font files, return \0 separated list
local find_opts="${find_filter} -print0"
while IFS= read -d / -r dir; do
xargs -- find "${nerdfonts_root_dir}/${dir}" -iname '*.[ot]tf' -type f <<< "$find_opts"
if [ -n "$(xargs -- find "${nerdfonts_root_dir}/${dir}" -iname "*.${extension1}" -type f <<< "$find_filter")" ]; then
xargs -- find "${nerdfonts_root_dir}/${dir}" -iname "*.${extension1}" -type f <<< "$find_opts"
else
xargs -- find "${nerdfonts_root_dir}/${dir}" -iname "*.${extension2}" -type f <<< "$find_opts"
fi
done <<< "${nerdfonts_dirs}"
}