charmbracelet / gum

A tool for glamorous shell scripts 🎀
MIT License
18.36k stars 348 forks source link

gum file should treat symbolic links to directories not as files but as directories #236

Open lwbt opened 2 years ago

lwbt commented 2 years ago

Describe the bug gum file seems to treat all symbolic links as files, but it would make sense to treat links to directories as directories, descend into the directory and allow to select files inside the respective directory.

To Reproduce Scenario: I have a directory with symbolic links to media files but also folders containing media files. I run mpv "$(gum file)" and want to select a file to play in one of the directories.

Expected behavior gum detects that the selected symbolic link's target is a directory, the user can select file 2 and mpv starts playing file 2.

Observed behavior gum treats the selected symbolic link as a file and mpv starts playing at file 1, because that is how mpv treats directories.

Additional context


Aside from that I am surprised that I can already navigate directories this way without the need for tools like ranger, which looked like a good idea, but I never started using it, but I will definitely use gum.

deicon commented 2 years ago

I tried to reproduce this but I don't see the actual issue when using gum file on a symbolic link as you describe. Running gum file on a tree like this

image

And selecting the symbolic links opens the subdirectory. As I would expect.

Screenshot 2022-11-21 at 14 17 37 image