dundee / gdu

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

Add export in interactive #298

Closed kadogo closed 8 months ago

kadogo commented 8 months ago

Hello

I don't really know Go, so it was trial and error for the most of it. It would fix #141, but you are free to do any modification to the PR. I did a few little tests, and it looks like it is working as expected.

I'm pretty sure that the code would be better that what I have done, that, I think, is also a bit dirty...

When launching GDU the argument -e is used to define the path of the dump when we will press S (uppercase s) in the interactive mode.

I didn't try to do a progress bar because I felt like it was another level, but the save looks pretty fast, so maybe it's alright.

Cheers

codecov[bot] commented 8 months ago

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (4e65a50) 93.58% compared to head (51797c3) 90.16%. Report is 41 commits behind head on master.

Files Patch % Lines
tui/actions.go 74.19% 16 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #298 +/- ## ========================================== - Coverage 93.58% 90.16% -3.43% ========================================== Files 29 31 +2 Lines 2806 3345 +539 ========================================== + Hits 2626 3016 +390 - Misses 139 267 +128 - Partials 41 62 +21 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dundee commented 8 months ago

Nice contribution, thank you!

kadogo commented 8 months ago

Thank you and you are welcome, when I see your updates it looks much better than my "pull together" thing ^^

I will give the new version a try in the week, based on the code I see window and stuff like that it sounds interesting ^^

dundee commented 8 months ago

Yes, my idea was that the user might not know that he will want to export the data later, so he might not add the option --export-file. Therefore I introduced an input field where you can specify the file name.

Not sure yet when I will release this as a next version. There is still some stuff that I would like to include.

But you can install the master version using:

go install github.com/dundee/gdu/v5/cmd/gdu@master
kadogo commented 8 months ago

No problem, I'm not in a hurry. I took 1 year before giving a try to the PR ^^

I gave it a try to the command, and it's working well. Having the window really make a big difference and let also export on the fly without worrying about the older filenames, thank you.