mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 14:43:39 +00:00
feat(analyze): open current directory in Finder via "O" key (#19)
This commit is contained in:
@@ -1610,6 +1610,7 @@ interactive_drill_down() {
|
|||||||
local need_scan=true
|
local need_scan=true
|
||||||
local wait_for_calc=false # Don't wait on first load, let user press 'r'
|
local wait_for_calc=false # Don't wait on first load, let user press 'r'
|
||||||
local temp_items="$TEMP_PREFIX.items"
|
local temp_items="$TEMP_PREFIX.items"
|
||||||
|
local status_message=""
|
||||||
|
|
||||||
# Cache variables to avoid recalculation
|
# Cache variables to avoid recalculation
|
||||||
local -a items=()
|
local -a items=()
|
||||||
@@ -1835,8 +1836,13 @@ interactive_drill_down() {
|
|||||||
output+=$'\n'
|
output+=$'\n'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$status_message" ]]; then
|
||||||
|
output+=" $status_message"$'\n\n'
|
||||||
|
status_message=""
|
||||||
|
fi
|
||||||
|
|
||||||
# Bottom help bar
|
# Bottom help bar
|
||||||
output+=" ${GRAY}↑/↓${NC} Navigate ${GRAY}|${NC} ${GRAY}Enter${NC} Open ${GRAY}|${NC} ${GRAY}←${NC} Back ${GRAY}|${NC} ${GRAY}Del${NC} Delete ${GRAY}|${NC} ${GRAY}Q/ESC${NC} Quit"$'\n'
|
output+=" ${GRAY}↑/↓${NC} Navigate ${GRAY}|${NC} ${GRAY}Enter${NC} Open ${GRAY}|${NC} ${GRAY}←${NC} Back ${GRAY}|${NC} ${GRAY}Del${NC} Delete ${GRAY}|${NC} ${GRAY}O${NC} Finder ${GRAY}|${NC} ${GRAY}Q/ESC${NC} Quit"$'\n'
|
||||||
|
|
||||||
# Output everything at once (single write = no flicker)
|
# Output everything at once (single write = no flicker)
|
||||||
printf "%b" "$output" >&2
|
printf "%b" "$output" >&2
|
||||||
@@ -1983,6 +1989,17 @@ interactive_drill_down() {
|
|||||||
return 1 # Return to menu
|
return 1 # Return to menu
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
"OPEN")
|
||||||
|
if command -v open >/dev/null 2>&1; then
|
||||||
|
if open "$current_path" >/dev/null 2>&1; then
|
||||||
|
status_message="${GREEN}✓${NC} Finder opened: ${GRAY}$current_path${NC}"
|
||||||
|
else
|
||||||
|
status_message="${YELLOW}Warning:${NC} Could not open ${GRAY}$current_path${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
status_message="${YELLOW}Warning:${NC} 'open' command not available"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
"DELETE")
|
"DELETE")
|
||||||
# Delete selected item (file or directory)
|
# Delete selected item (file or directory)
|
||||||
if [[ $cursor -lt ${#items[@]} ]]; then
|
if [[ $cursor -lt ${#items[@]} ]]; then
|
||||||
@@ -2285,6 +2302,7 @@ main() {
|
|||||||
echo " Enter / → Open selected folder"
|
echo " Enter / → Open selected folder"
|
||||||
echo " ← Go back to parent directory"
|
echo " ← Go back to parent directory"
|
||||||
echo " Delete Delete selected file/folder (requires confirmation)"
|
echo " Delete Delete selected file/folder (requires confirmation)"
|
||||||
|
echo " O Reveal current directory in Finder"
|
||||||
echo " Q / ESC Quit the explorer"
|
echo " Q / ESC Quit the explorer"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Features:"
|
echo "Features:"
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ read_key() {
|
|||||||
'd'|'D') echo "DELETE" ;;
|
'd'|'D') echo "DELETE" ;;
|
||||||
'r'|'R') echo "RETRY" ;;
|
'r'|'R') echo "RETRY" ;;
|
||||||
'?') echo "HELP" ;;
|
'?') echo "HELP" ;;
|
||||||
|
'o'|'O') echo "OPEN" ;;
|
||||||
$'\x03') echo "QUIT" ;; # Ctrl+C
|
$'\x03') echo "QUIT" ;; # Ctrl+C
|
||||||
$'\x7f'|$'\x08') echo "DELETE" ;; # Delete key (labeled "delete" on Mac, actually backspace)
|
$'\x7f'|$'\x08') echo "DELETE" ;; # Delete key (labeled "delete" on Mac, actually backspace)
|
||||||
$'\x1b')
|
$'\x1b')
|
||||||
|
|||||||
Reference in New Issue
Block a user