dundee / gdu

Fast disk usage analyzer with console interface written in Go
MIT License
4.02k stars 144 forks source link

simple file viewer for text files #10

Closed chrbayer closed 3 years ago

chrbayer commented 3 years ago

Sometimes it is very useful to be able to simply look into a text file while browsing through the files and directories, please add a very basic file viewer :-)

ouuan commented 3 years ago

I think this is not what a du (disk usage analyzer) does. Usually, a du is used to find which file takes the most space, not to browse the files. And text files are usually not big.

Maybe you are looking for something like nnn?

admirabilis commented 3 years ago

I see the use case for this. When using a file manager like mc, I am generally browsing where I know mostly everything - whereas with gdu, I'm generally exploring new places. Many times, while using ncdu, I've had a "what's this file?" moment, and I had to copy the directory path and paste it into a new shell just to view what the supposed file contains.

I guess a simple option to implement would be a key to spawn $PAGER (which generally can be used for text or compressed text), and another key for running xdg-open (which will call a GUI for any file type).

Another key to run a shell in $PWD could be more troublesome to implement, the previous two keys should cover most use cases.

dundee commented 3 years ago

The xdg-open way can be implemented quite easily, but the rest is hard (maybe even impossible), because of the way how the terminal UI library works. But I am not sure if it's nice to open files from gdu (terminal app) into GUI apps. Internal file viewer would be probably better (but not easy to implement).

admirabilis commented 3 years ago

Thanks so much, @dundee

dundee commented 3 years ago

Thanks so much, @dundee

You welcome!