mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 06:46:40 +00:00
fix(bin/generate-nerdfonts): correctly parse input sources and find fonts
This commit is contained in:
@@ -67,7 +67,8 @@ main() {
|
|||||||
|
|
||||||
local patcher="${args[0]}"
|
local patcher="${args[0]}"
|
||||||
local outputDir="${args[1]}"
|
local outputDir="${args[1]}"
|
||||||
local sources=("${args[@]:2}")
|
local input_sources=("${args[@]:2}")
|
||||||
|
local sources=()
|
||||||
|
|
||||||
if [[ -z "$patcher" || -z "$outputDir" ]]; then
|
if [[ -z "$patcher" || -z "$outputDir" ]]; then
|
||||||
show-help 1>&2
|
show-help 1>&2
|
||||||
@@ -93,16 +94,23 @@ main() {
|
|||||||
mkdir -p "$outputDir"
|
mkdir -p "$outputDir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ ${#input_sources[@]} -eq 0 ]]; then
|
||||||
|
echo "===> No sources specified, searching for font files in current directory"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
sources+=("$line")
|
sources+=("$line")
|
||||||
done < <(find-sources "$(abs_dirname "$(pwd)")")
|
done < <(find-sources "$(abs_path "$(pwd)")")
|
||||||
|
echo "===> Found ${#sources[@]} font files:"
|
||||||
|
for src in "${sources[@]}"; do
|
||||||
|
echo "---> - $src"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for item in "$@"; do
|
for item in "${input_sources[@]}"; do
|
||||||
if [[ -d $item ]]; then
|
if [[ -d $item ]]; then
|
||||||
|
echo "===> Finding for font files in ${item}:"
|
||||||
# If it's a directory, find sources and add to array
|
# If it's a directory, find sources and add to array
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
|
echo "---> - $line"
|
||||||
sources+=("$line")
|
sources+=("$line")
|
||||||
done < <(find-sources "$item")
|
done < <(find-sources "$item")
|
||||||
else
|
else
|
||||||
@@ -113,7 +121,7 @@ main() {
|
|||||||
|
|
||||||
# abort if no sources found
|
# abort if no sources found
|
||||||
if [[ ${#sources[@]} -eq 0 ]]; then
|
if [[ ${#sources[@]} -eq 0 ]]; then
|
||||||
echo "No font files found" 1>&2
|
error "No font files found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user