more clear

This commit is contained in:
goldsquid
2025-12-19 13:07:14 +07:00
parent f282b2173f
commit 25c2f8c101
2 changed files with 12 additions and 2 deletions

View File

@@ -33,6 +33,8 @@ for part in "${parts[@]}"; do
fi
if $include; then
echo "Checking ${part%.yml}..." >&2
# Capture stdout (ratio) while letting stderr display naturally
static_ratio="$($BASEPATH/show-static-file-size.sh ${part%.yml})"
static_ratio="0$static_ratio"
total_kb=$($BASEPATH/show-file-size.sh ${part%.yml})
@@ -46,6 +48,7 @@ for part in "${parts[@]}"; do
static_size=$(echo "$static_size + $static_part" | bc)
#output=$(echo "$static_size" | numfmt --to=iec --suffix=B --format="%.2f")
#echo "$output"
echo "" >&2
fi
done

View File

@@ -22,11 +22,18 @@ for key in $keys; do
# Print the size of the file or directory
size=$(du -sL "$prefix/_data/$path" 2>/dev/null | awk '{print $1}')
static_size=$((static_size + size))
# Print the detected path to stderr so it doesn't interfere with ratio output
echo "$prefix/_data/$path" >&2
# Format size in human-readable format
size_formatted=$(echo "$(( size * 1024 ))" | numfmt --to=iec --suffix=B --format="%.2f")
# Print the detected path with size to stderr (one per line)
echo "$size_formatted $prefix/_data/$path" >&2
fi
done < static-file-path-list.txt
done
# Print total static size to stderr
static_total_formatted=$(echo "$(( static_size * 1024 ))" | numfmt --to=iec --suffix=B --format="%.2f")
echo "---" >&2
echo "Total static: $static_total_formatted" >&2
ratio=$(bc -l <<< "scale=2; $static_size/$total_size")
echo "$ratio"