Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add File Picker #37

Closed
mahadevans87 opened this issue Jan 15, 2021 · 8 comments
Closed

Feature Request: Add File Picker #37

mahadevans87 opened this issue Jan 15, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@mahadevans87
Copy link

mahadevans87 commented Jan 15, 2021

Is it possible to create a File Picker Bubble that could be easily used?

I would imagine a cursor and selection that could be moved around using arrow keys and a tree like view for files/folders

@quenbyako
Copy link
Contributor

@mahadevans87 sounds great, could you please visualise your idea or sort of? i mean, in ascii graphics 😄

@mahadevans87
Copy link
Author

@quenbyako Is it possible to build something like this?

image

Source : https://github.com/jarun/nnn

@meowgorithm
Copy link
Member

Yeah, it's very possible to build something like that with Bubble Tea. I'd put the file listing in a viewport component so it can scroll.

Modu is a good reference on how to do implement something like that from a UI standpoint.

We're big fans of nnn, btw.

@quenbyako
Copy link
Contributor

quenbyako commented Jan 17, 2021

@meowgorithm @mahadevans87 quick ask: does go has some package that you know, which is providing icon utilities or any font stuff, which we can use?

i've created already file toolbox and ls-alternative looks like this result on you screenshot:
image

It's looks not sooooo cool looking, but it might be a goof start point on working with this feature. My general problem was on managin all icons from font, for example: this project allows you to add custom font with icon glyphs in private unicode area. Cool? Cool. But main problem is that you generally don't know which unicode glyph id contains specific icon. So i have abadoned this toolbox, cause i didn't find nice framework for terminal ui rendering. Maybe we can find/implement this feature and add icons support for bubbletea?

Also, it's off topic generally, but i working on cli argument parser, this filetools project use it, i want to make typical project structure, which can be used as template for any cli app. But it's really off topic, i just want warn you about a lot of problems with this toolbox, if i'll opensource it

@muesli muesli added the enhancement New feature or request label Oct 5, 2022
@mrusme
Copy link

mrusme commented Jan 10, 2023

I'm in need for a file picker as well and I came across this issue. I'm wondering whether it makes sense to actually build a file picker from scratch or instead integrate something that supports running arbitary commands, display their output within a specified area while the command runs and then read a temporary file after the command has exited. It would also need to forward input to the command for as long as the command is still running.

With this generic implementation users could run any terminal file manager they're comfortable with (e.g. lf -selection-path /tmp/bla, nnn -p -, ranger something something, ...) and the bubble wouldn't actually need to implement all the logic that usually goes into a good file manager. It could offer some presets for popular file managers like lf, nnn, ranger, mc, etc.

The flow would be:

  • Render a "Select file ..." button somewhere that would activate the file picker bubble (this doesn't have to be part of the implementation though as button interactions haven't yet been clearly specififed by Bubble Tea)
  • Display the virtual terminal bubble area that outputs the command's stdout and forward all stdin to the command, until the command has quit
  • Run the command with a temporary file for outputting the selected file(s), e.g. lf -selection-path /tmp/bla
  • Wait for the command to quit, then read /tmp/bla and provide its content as []string via a .Value() function on the Model.

Wdyt?

@mrusme
Copy link

mrusme commented Jan 13, 2023

FYI because I just stumbled upon this:

It seems part of an file picker is already available through teacup.

@KaiAragaki
Copy link

Was this closed in #343?

@maaslalani
Copy link
Member

Yes thank you! File picker bubble was added in #343!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants