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

enhancement: size of graveyard #11

Open
JeromeSchmied opened this issue Apr 13, 2024 · 7 comments
Open

enhancement: size of graveyard #11

JeromeSchmied opened this issue Apr 13, 2024 · 7 comments

Comments

@JeromeSchmied
Copy link

I've just installed this great tool, seems amazing.

One thing that would make it even better would be I think to show disk usage by graveyard.
Something like with rip -i, eg. rip -s:

graveyard: /tmp/graveyard-user/
428 files in 3 directories: 131M
    file,              2K: /home/user/.viminfo
     dir,   2 files,  81K: /home/user/.w3m
     dir, 425 files, 130M: /home/user/.cache

or something.

Would be awesome.

@MilesCranmer
Copy link
Owner

MilesCranmer commented Apr 14, 2024

Thanks and good idea. The one potential issue with the simplest approach to this [see below] is I think it might take longer to delete files, right?

For example, right now we can get away with simply a fs::rename for many cases which is very cheap:

rip2/src/lib.rs

Lines 284 to 286 in c0e3092

if fs::rename(target, dest).is_ok() {
return Ok(());
}

But if we want to add more info to the record, like size and filecounts:

rip2/src/record.rs

Lines 10 to 14 in c0e3092

pub struct RecordItem<'a> {
_time: &'a str,
pub orig: &'a Path,
pub dest: &'a Path,
}

I think it would take longer.


Alternatively, maybe we could compute this on-the-fly? Like, if you do rip -s, it could compute sizes by walking through the graveyard, rather than from the record. Wdyt?

Could even use the same code that e.g., dua-cli does for some of this.

@JeromeSchmied
Copy link
Author

I think the 2. solution you mentioned would be perfect.
So just compute sizes on-the-fly when rip -s

@MilesCranmer
Copy link
Owner

I wonder if it would be possible to simply pipe it to lsd or something? https://github.com/lsd-rs/lsd

Then you could pass whatever arguments you would normally pass to ls. I guess we would need to add something for 'time file was deleted' or something.

@JeromeSchmied
Copy link
Author

Good idea.

@MilesCranmer
Copy link
Owner

I'm looking at https://github.com/zhiburt/tabled/ for doing this.

@JeromeSchmied
Copy link
Author

looks like an amazing library

@MilesCranmer
Copy link
Owner

I also wonder if we could instead modify https://github.com/Byron/dua-cli to get some kind of interactive restoration... Seems like a fair amount of work though.

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

No branches or pull requests

2 participants