1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-23 22:05:07 +00:00

chore: simplify dry run docs and change interactive shortcut to SPACE

This commit is contained in:
Tw93
2025-10-03 10:58:34 +08:00
parent ee98bd2e96
commit 5b60837b8b
2 changed files with 24 additions and 35 deletions

30
mole
View File

@@ -268,7 +268,22 @@ interactive_main_menu() {
show_cursor
case $current_option in
1)
echo -e "${BLUE}Press 'd' for Dry Run preview, Enter to start cleaning (q to cancel)${NC}"
echo -e "${BLUE}Press SPACE for Dry Run preview, Enter to start cleaning (Esc/q to cancel)${NC}"
# SPACE => dry run; Enter => normal; Esc/q => cancel
IFS= read -r -s -n1 key2 || true
if [[ "$key2" == $'\e' ]]; then
# ESC pressed -> cancel
:
elif [[ "$key2" == ' ' ]]; then
exec "$SCRIPT_DIR/bin/clean.sh" --dry-run
elif [[ "$key2" == $'\n' || -z "$key2" ]]; then
exec "$SCRIPT_DIR/bin/clean.sh"
elif [[ "$key2" == 'q' || "$key2" == 'Q' ]]; then
:
else
exec "$SCRIPT_DIR/bin/clean.sh"
fi
continue
IFS= read -r -s -n1 key2 || true
if [[ "$key2" == $'\n' || -z "$key2" ]]; then
exec "$SCRIPT_DIR/bin/clean.sh"
@@ -291,13 +306,16 @@ interactive_main_menu() {
show_cursor
case $key in
1)
echo -e "${BLUE}Press 'd' for Dry Run preview, Enter to start cleaning (q to cancel)${NC}"
echo -e "${BLUE}Press SPACE for Dry Run preview, Enter to start cleaning (Esc/q to cancel)${NC}"
# SPACE => dry run; Enter => normal; Esc/q => cancel
IFS= read -r -s -n1 key2 || true
if [[ "$key2" == $'\n' || -z "$key2" ]]; then
exec "$SCRIPT_DIR/bin/clean.sh"
elif [[ "$key2" == "d" || "$key2" == "D" ]]; then
if [[ "$key2" == $'\e' ]]; then
:
elif [[ "$key2" == ' ' ]]; then
exec "$SCRIPT_DIR/bin/clean.sh" --dry-run
elif [[ "$key2" == "q" || "$key2" == "Q" ]]; then
elif [[ "$key2" == $'\n' || -z "$key2" ]]; then
exec "$SCRIPT_DIR/bin/clean.sh"
elif [[ "$key2" == 'q' || "$key2" == 'Q' ]]; then
:
else
exec "$SCRIPT_DIR/bin/clean.sh"