feat: Refactor helper functions (#935)

This commit is contained in:
Kroese
2025-03-18 12:57:52 +01:00
committed by GitHub
parent 4018eeadb4
commit 7fce3a98fe
4 changed files with 176 additions and 146 deletions

View File

@@ -26,7 +26,7 @@ do
bytes=$(du -sb "$file" | cut -f1)
if (( bytes > 1000 )); then
if [ -z "$total" ] || [[ "$total" == "0" ]]; then
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
else
size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')"
size="$size%"