1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 04:10:40 +00:00

chore: auto format code

This commit is contained in:
Tw93
2026-01-04 09:52:09 +00:00
parent 3906c020fe
commit b044fa3e60
5 changed files with 54 additions and 57 deletions

View File

@@ -106,18 +106,18 @@ safe_remove() {
if [[ -e "$path" ]]; then
local size_kb
size_kb=$(get_path_size_kb "$path" 2>/dev/null || echo "0")
size_kb=$(get_path_size_kb "$path" 2> /dev/null || echo "0")
if [[ "$size_kb" -gt 0 ]]; then
file_size=$(bytes_to_human "$((size_kb * 1024))")
fi
if [[ -f "$path" || -d "$path" ]] && ! [[ -L "$path" ]]; then
local mod_time
mod_time=$(stat -f%m "$path" 2>/dev/null || echo "0")
mod_time=$(stat -f%m "$path" 2> /dev/null || echo "0")
local now
now=$(date +%s 2>/dev/null || echo "0")
now=$(date +%s 2> /dev/null || echo "0")
if [[ "$mod_time" -gt 0 && "$now" -gt 0 ]]; then
file_age=$(( (now - mod_time) / 86400 ))
file_age=$(((now - mod_time) / 86400))
fi
fi
fi
@@ -183,20 +183,20 @@ safe_sudo_remove() {
local file_size=""
local file_age=""
if sudo test -e "$path" 2>/dev/null; then
if sudo test -e "$path" 2> /dev/null; then
local size_kb
size_kb=$(sudo du -sk "$path" 2>/dev/null | awk '{print $1}' || echo "0")
size_kb=$(sudo du -sk "$path" 2> /dev/null | awk '{print $1}' || echo "0")
if [[ "$size_kb" -gt 0 ]]; then
file_size=$(bytes_to_human "$((size_kb * 1024))")
fi
if sudo test -f "$path" 2>/dev/null || sudo test -d "$path" 2>/dev/null; then
if sudo test -f "$path" 2> /dev/null || sudo test -d "$path" 2> /dev/null; then
local mod_time
mod_time=$(sudo stat -f%m "$path" 2>/dev/null || echo "0")
mod_time=$(sudo stat -f%m "$path" 2> /dev/null || echo "0")
local now
now=$(date +%s 2>/dev/null || echo "0")
now=$(date +%s 2> /dev/null || echo "0")
if [[ "$mod_time" -gt 0 && "$now" -gt 0 ]]; then
file_age=$(( (now - mod_time) / 86400 ))
file_age=$(((now - mod_time) / 86400))
fi
fi
fi