mirror of
https://github.com/tw93/Mole.git
synced 2026-03-24 18:05:14 +00:00
chore: auto format code
This commit is contained in:
@@ -461,11 +461,11 @@ bytes_to_human() {
|
|||||||
|
|
||||||
# GB: >= 1,000,000,000 bytes
|
# GB: >= 1,000,000,000 bytes
|
||||||
if ((bytes >= 1000000000)); then
|
if ((bytes >= 1000000000)); then
|
||||||
local scaled=$(( (bytes * 100 + 500000000) / 1000000000 ))
|
local scaled=$(((bytes * 100 + 500000000) / 1000000000))
|
||||||
printf "%d.%02dGB\n" $((scaled / 100)) $((scaled % 100))
|
printf "%d.%02dGB\n" $((scaled / 100)) $((scaled % 100))
|
||||||
# MB: >= 1,000,000 bytes
|
# MB: >= 1,000,000 bytes
|
||||||
elif ((bytes >= 1000000)); then
|
elif ((bytes >= 1000000)); then
|
||||||
local scaled=$(( (bytes * 10 + 500000) / 1000000 ))
|
local scaled=$(((bytes * 10 + 500000) / 1000000))
|
||||||
printf "%d.%01dMB\n" $((scaled / 10)) $((scaled % 10))
|
printf "%d.%01dMB\n" $((scaled / 10)) $((scaled % 10))
|
||||||
# KB: >= 1,000 bytes (round up to nearest KB instead of decimal)
|
# KB: >= 1,000 bytes (round up to nearest KB instead of decimal)
|
||||||
elif ((bytes >= 1000)); then
|
elif ((bytes >= 1000)); then
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ get_path_size_kb() {
|
|||||||
echo "0"
|
echo "0"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# For .app bundles, prefer mdls logical size as it matches Finder
|
# For .app bundles, prefer mdls logical size as it matches Finder
|
||||||
# (APFS clone/sparse files make 'du' severely underreport apps like Xcode)
|
# (APFS clone/sparse files make 'du' severely underreport apps like Xcode)
|
||||||
if [[ "$path" == *.app || "$path" == *.app/ ]]; then
|
if [[ "$path" == *.app || "$path" == *.app/ ]]; then
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
bytes_to_human_new() {
|
bytes_to_human_new() {
|
||||||
local bytes="$1"
|
local bytes="$1"
|
||||||
if ((bytes >= 1000000000)); then
|
if ((bytes >= 1000000000)); then
|
||||||
local scaled=$(( (bytes * 100 + 500000000) / 1000000000 ))
|
local scaled=$(((bytes * 100 + 500000000) / 1000000000))
|
||||||
printf "%d.%02dGB\n" $((scaled / 100)) $((scaled % 100))
|
printf "%d.%02dGB\n" $((scaled / 100)) $((scaled % 100))
|
||||||
elif ((bytes >= 1000000)); then
|
elif ((bytes >= 1000000)); then
|
||||||
local scaled=$(( (bytes * 10 + 500000) / 1000000 ))
|
local scaled=$(((bytes * 10 + 500000) / 1000000))
|
||||||
printf "%d.%01dMB\n" $((scaled / 10)) $((scaled % 10))
|
printf "%d.%01dMB\n" $((scaled / 10)) $((scaled % 10))
|
||||||
elif ((bytes >= 1000)); then
|
elif ((bytes >= 1000)); then
|
||||||
printf "%dKB\n" $(((bytes + 500) / 1000))
|
printf "%dKB\n" $(((bytes + 500) / 1000))
|
||||||
|
|||||||
Reference in New Issue
Block a user