Make auto cleanup fast and clean
Changes: - Suppress trace eraser output in auto mode (only show ✓) - Clear screen after cleanup - Leave user in /root directory - Single success message Result: - Question -> yes -> quick cleanup -> ✓ All traces removed -> /root - Fast, minimal output, clean exit
This commit is contained in:
+2
-2
@@ -1507,8 +1507,8 @@ main() {
|
||||
read -p "Clean history and remove traces? (yes/no): " clean_hist
|
||||
|
||||
if [ "$clean_hist" = "yes" ]; then
|
||||
# Run trace eraser in non-interactive mode
|
||||
TRACE_ERASER_AUTO=yes bash "$BASE_DIR/tools/erase-toolkit-traces.sh"
|
||||
# Run trace eraser in non-interactive mode (suppress output)
|
||||
TRACE_ERASER_AUTO=yes bash "$BASE_DIR/tools/erase-toolkit-traces.sh" 2>&1 | grep -E "^✓|^$" || true
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -31,9 +31,12 @@ if [ "$TRACE_ERASER_AUTO" != "yes" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Only show progress if not in auto mode
|
||||
if [ "$TRACE_ERASER_AUTO" != "yes" ]; then
|
||||
echo ""
|
||||
echo "Removing traces..."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Patterns to remove from history
|
||||
PATTERNS=(
|
||||
@@ -159,13 +162,11 @@ fi
|
||||
|
||||
# Offer to remove the entire toolkit (AFTER history cleaning)
|
||||
if [ "$TRACE_ERASER_AUTO" = "yes" ]; then
|
||||
# Auto mode: always remove directory and skip prompt
|
||||
echo ""
|
||||
echo "Removing toolkit directory..."
|
||||
cd /root
|
||||
rm -rf "$SCRIPT_DIR"
|
||||
echo ""
|
||||
echo -e "${GREEN}✓ Toolkit completely removed${NC}"
|
||||
# Auto mode: quick cleanup, minimal output
|
||||
cd /root 2>/dev/null
|
||||
rm -rf "$SCRIPT_DIR" 2>/dev/null
|
||||
clear
|
||||
echo -e "${GREEN}✓ All traces removed${NC}"
|
||||
else
|
||||
# Manual mode: ask user
|
||||
echo ""
|
||||
@@ -190,9 +191,9 @@ else
|
||||
echo "Toolkit directory remains at: $SCRIPT_DIR"
|
||||
echo "You can manually remove it later with: rm -rf $SCRIPT_DIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "All traces removed. The trace eraser commands will also be"
|
||||
echo "removed when you log out or start a new shell session."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user