mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 17:00:17 +00:00
Support vim's arrow keys
This commit is contained in:
@@ -64,6 +64,7 @@ mo --version # Show installed version
|
||||
- Preview the cleanup by running `mo clean --dry-run` and reviewing the list.
|
||||
- Use `mo clean --whitelist` to manage protected caches.
|
||||
- Use `mo touchid` to approve sudo with Touch ID instead of typing your password.
|
||||
- Prefer Vim-style navigation? All menus understand `h/j/k/l` in addition to the arrow keys.
|
||||
|
||||
## Features in Detail
|
||||
|
||||
|
||||
BIN
bin/analyze-go
BIN
bin/analyze-go
Binary file not shown.
@@ -578,17 +578,12 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
m.offset = m.selected - viewport + 1
|
||||
}
|
||||
}
|
||||
case "enter":
|
||||
case "enter", "right", "l":
|
||||
if m.showLargeFiles {
|
||||
return m, nil
|
||||
}
|
||||
return m.enterSelectedDir()
|
||||
case "right":
|
||||
if m.showLargeFiles {
|
||||
return m, nil
|
||||
}
|
||||
return m.enterSelectedDir()
|
||||
case "b", "left":
|
||||
case "b", "left", "h":
|
||||
if m.showLargeFiles {
|
||||
m.showLargeFiles = false
|
||||
return m, nil
|
||||
@@ -640,7 +635,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
*m.currentPath = ""
|
||||
}
|
||||
return m, tea.Batch(m.scanCmd(m.path), tickCmd())
|
||||
case "l":
|
||||
case "L":
|
||||
m.showLargeFiles = !m.showLargeFiles
|
||||
if m.showLargeFiles {
|
||||
m.largeSelected = 0
|
||||
|
||||
@@ -286,7 +286,11 @@ read_key() {
|
||||
$'\n' | $'\r') echo "ENTER" ;;
|
||||
' ') echo "SPACE" ;;
|
||||
'q' | 'Q') echo "QUIT" ;;
|
||||
'h' | 'H') echo "HELP" ;;
|
||||
'h') echo "LEFT" ;;
|
||||
'j') echo "DOWN" ;;
|
||||
'k') echo "UP" ;;
|
||||
'l') echo "RIGHT" ;;
|
||||
'm' | 'M') echo "MORE" ;;
|
||||
'v' | 'V') echo "VERSION" ;;
|
||||
't' | 'T') echo "TOUCHID" ;;
|
||||
'u' | 'U') echo "UPDATE" ;;
|
||||
|
||||
@@ -733,9 +733,6 @@ paginated_multi_select() {
|
||||
restore_terminal
|
||||
return 0
|
||||
;;
|
||||
"HELP")
|
||||
# Removed help screen, users can explore the interface
|
||||
;;
|
||||
esac
|
||||
|
||||
# Drain any accumulated input after processing (e.g., mouse wheel events)
|
||||
|
||||
@@ -216,23 +216,6 @@ paginated_multi_select() {
|
||||
printf "${clear_line}" >&2
|
||||
}
|
||||
|
||||
# Show help screen
|
||||
show_help() {
|
||||
printf "\033[H\033[J" >&2
|
||||
cat >&2 << EOF
|
||||
Help - Navigation Controls
|
||||
==========================
|
||||
|
||||
${ICON_NAV_UP} / ${ICON_NAV_DOWN} Navigate up/down
|
||||
Space Select/deselect item
|
||||
Enter Confirm selection
|
||||
Q / ESC Exit
|
||||
|
||||
Press any key to continue...
|
||||
EOF
|
||||
read -n 1 -s >&2
|
||||
}
|
||||
|
||||
# Main interaction loop
|
||||
while true; do
|
||||
draw_menu
|
||||
@@ -294,7 +277,6 @@ EOF
|
||||
selected[i]=false
|
||||
done
|
||||
;;
|
||||
"HELP") show_help ;;
|
||||
"ENTER")
|
||||
# Store result in global variable instead of returning via stdout
|
||||
local -a selected_indices=()
|
||||
|
||||
6
mole
6
mole
@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/lib/common.sh"
|
||||
|
||||
# Version info
|
||||
VERSION="1.10.8"
|
||||
VERSION="1.10.9"
|
||||
MOLE_TAGLINE="can dig deep to clean your Mac."
|
||||
|
||||
# Check if Touch ID is already configured
|
||||
@@ -534,7 +534,7 @@ show_main_menu() {
|
||||
if [[ -t 0 ]]; then
|
||||
printf '\r\033[2K\n'
|
||||
# Show TouchID if not configured, otherwise show Update
|
||||
local controls="${GRAY}↑↓ | Enter | H Help | "
|
||||
local controls="${GRAY}↑↓ | Enter | M More | "
|
||||
if ! is_touchid_configured; then
|
||||
controls="${controls}T TouchID"
|
||||
else
|
||||
@@ -632,7 +632,7 @@ interactive_main_menu() {
|
||||
show_cursor
|
||||
exec "$SCRIPT_DIR/bin/status.sh"
|
||||
;;
|
||||
"HELP")
|
||||
"MORE")
|
||||
show_cursor
|
||||
clear
|
||||
show_help
|
||||
|
||||
Reference in New Issue
Block a user