mirror of
https://github.com/tw93/Mole.git
synced 2026-02-11 01:54:16 +00:00
fix: enhance local snapshot warning and improve disk space calculation for macOS
This commit is contained in:
3
AGENT.md
3
AGENT.md
@@ -13,8 +13,11 @@ Use this file as the single source of truth for how to work on Mole.
|
|||||||
- Comments must be English, concise, and intent-focused.
|
- Comments must be English, concise, and intent-focused.
|
||||||
- Use comments for safety boundaries, non-obvious logic, or flow context.
|
- Use comments for safety boundaries, non-obvious logic, or flow context.
|
||||||
- Entry scripts start with ~3 short lines describing purpose/behavior.
|
- Entry scripts start with ~3 short lines describing purpose/behavior.
|
||||||
|
- Shell code must use shell-only helpers (no Python).
|
||||||
|
- Go code must use Go-only helpers (no Python).
|
||||||
- Do not remove installer flags `--prefix`/`--config` (update flow depends on them).
|
- Do not remove installer flags `--prefix`/`--config` (update flow depends on them).
|
||||||
- Do not commit or submit code changes unless explicitly requested.
|
- Do not commit or submit code changes unless explicitly requested.
|
||||||
|
- You may use `gh` to access GitHub information when needed.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,8 @@ clean_local_snapshots() {
|
|||||||
|
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
if [[ ! -t 0 ]]; then
|
if [[ ! -t 0 ]]; then
|
||||||
echo -e " ${YELLOW}!${NC} Local snapshots found, skipping non-interactive mode"
|
echo -e " ${YELLOW}!${NC} ${#snapshots[@]} local snapshot(s) found, skipping non-interactive mode"
|
||||||
|
echo -e " ${YELLOW}${ICON_WARNING}${NC} ${GRAY}Tip: Snapshots may cause Disk Utility to show different 'Available' values${NC}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
echo -e " ${YELLOW}!${NC} Time Machine local snapshots found"
|
echo -e " ${YELLOW}!${NC} Time Machine local snapshots found"
|
||||||
|
|||||||
@@ -171,7 +171,12 @@ detect_architecture() {
|
|||||||
# Get free disk space on root volume
|
# Get free disk space on root volume
|
||||||
# Returns: human-readable string (e.g., "100G")
|
# Returns: human-readable string (e.g., "100G")
|
||||||
get_free_space() {
|
get_free_space() {
|
||||||
command df -h / | awk 'NR==2 {print $4}'
|
local target="/"
|
||||||
|
if [[ -d "/System/Volumes/Data" ]]; then
|
||||||
|
target="/System/Volumes/Data"
|
||||||
|
fi
|
||||||
|
|
||||||
|
df -h "$target" | awk 'NR==2 {print $4}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get Darwin kernel major version (e.g., 24 for 24.2.0)
|
# Get Darwin kernel major version (e.g., 24 for 24.2.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user