mirror of
https://github.com/tw93/Mole.git
synced 2026-03-24 01:30:07 +00:00
refactor: use bytes_to_human_kb for dynamic size formatting
- Replace inline dynamic formatting with shared bytes_to_human_kb() - Apply to both clean and purge commands - Simplify movie comparison with integer arithmetic
This commit is contained in:
@@ -210,12 +210,12 @@ perform_purge() {
|
||||
fi
|
||||
|
||||
if [[ $total_size_cleaned -gt 0 ]]; then
|
||||
local freed_gb
|
||||
freed_gb=$(echo "$total_size_cleaned" | awk '{printf "%.2f", $1/1024/1024}')
|
||||
local freed_size_human
|
||||
freed_size_human=$(bytes_to_human_kb "$total_size_cleaned")
|
||||
|
||||
local summary_line="Space freed: ${GREEN}${freed_gb}GB${NC}"
|
||||
local summary_line="Space freed: ${GREEN}${freed_size_human}${NC}"
|
||||
if [[ "${MOLE_DRY_RUN:-0}" == "1" ]]; then
|
||||
summary_line="Would free: ${GREEN}${freed_gb}GB${NC}"
|
||||
summary_line="Would free: ${GREEN}${freed_size_human}${NC}"
|
||||
fi
|
||||
[[ $total_items_cleaned -gt 0 ]] && summary_line+=" | Items: $total_items_cleaned"
|
||||
summary_line+=" | Free: $(get_free_space)"
|
||||
|
||||
Reference in New Issue
Block a user