1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 13:16:47 +00:00

docs: add --debug flag documentation and update tests

- Add --dry-run --debug usage examples to README
- Add detailed preview tip explaining debug log features
- Update tests/clean_core.bats for debug functionality
- Closes GitHub issue #242
This commit is contained in:
Tw93
2026-01-04 17:30:49 +08:00
parent 0520287ec1
commit 768b1bf274
2 changed files with 17 additions and 0 deletions

View File

@@ -60,8 +60,10 @@ mo --version # Show installed version
mo clean --dry-run # Preview the cleanup plan mo clean --dry-run # Preview the cleanup plan
mo clean --whitelist # Manage protected caches mo clean --whitelist # Manage protected caches
mo clean --dry-run --debug # Detailed preview with risk levels and file info
mo optimize --dry-run # Preview optimization actions mo optimize --dry-run # Preview optimization actions
mo optimize --debug # Run with detailed operation logs
mo optimize --whitelist # Manage protected optimization rules mo optimize --whitelist # Manage protected optimization rules
mo purge --paths # Configure project scan directories mo purge --paths # Configure project scan directories
``` ```
@@ -75,6 +77,7 @@ mo purge --paths # Configure project scan directories
- **Shell Completion**: Enable tab completion by running `mo completion` (auto-detect and install). - **Shell Completion**: Enable tab completion by running `mo completion` (auto-detect and install).
- **Navigation**: Supports standard arrow keys and Vim bindings (`h/j/k/l`). - **Navigation**: Supports standard arrow keys and Vim bindings (`h/j/k/l`).
- **Debug**: View detailed logs by appending the `--debug` flag (e.g., `mo clean --debug`). - **Debug**: View detailed logs by appending the `--debug` flag (e.g., `mo clean --debug`).
- **Detailed Preview**: Combine `--dry-run --debug` for comprehensive operation details including risk levels, file paths, sizes, and expected outcomes. Check `~/.config/mole/mole_debug_session.log` for full details.
## Features in Detail ## Features in Detail

View File

@@ -59,6 +59,20 @@ EOF
[ -f "$HOME/Library/Caches/WhitelistedApp/data.tmp" ] [ -f "$HOME/Library/Caches/WhitelistedApp/data.tmp" ]
} }
@test "mo clean honors whitelist entries with $HOME literal" {
mkdir -p "$HOME/Library/Caches/WhitelistedApp"
echo "keep me" > "$HOME/Library/Caches/WhitelistedApp/data.tmp"
cat > "$HOME/.config/mole/whitelist" << 'EOF'
$HOME/Library/Caches/WhitelistedApp*
EOF
run env HOME="$HOME" MOLE_TEST_MODE=1 "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[[ "$output" == *"Protected"* ]]
[ -f "$HOME/Library/Caches/WhitelistedApp/data.tmp" ]
}
@test "mo clean protects Maven repository by default" { @test "mo clean protects Maven repository by default" {
mkdir -p "$HOME/.m2/repository/org/example" mkdir -p "$HOME/.m2/repository/org/example"
echo "dependency" > "$HOME/.m2/repository/org/example/lib.jar" echo "dependency" > "$HOME/.m2/repository/org/example/lib.jar"