2
3
Fork
You've already forked ncsu
0

WIP: Support moving files/dirs to trash (fixes #215) #217

Closed
SUPERCILEX wants to merge 1 commit from trash into zig
pull from: trash
merge into: selfisekai:zig
selfisekai:zig
selfisekai:zig0.16
selfisekai:master
selfisekai:zig-threaded
selfisekai:openat
selfisekai:chdir
selfisekai:clear
selfisekai:compll
SUPERCILEX commented 2022年12月21日 01:50:33 +01:00 (Migrated from code.blicky.net)
Copy link

This PR should mostly be in shape, expect that:

  • I'm not handling g_file_trash errors. No idea what the ncdu error handling strat is.
  • Static linking is broken. I won't have the time to look into this—hopefully someone else can pick up the torch.
This PR should mostly be in shape, expect that: - I'm not handling `g_file_trash` errors. No idea what the ncdu error handling strat is. - Static linking is broken. I won't have the time to look into this—hopefully someone else can pick up the torch.
yorhel commented 2022年12月21日 07:25:12 +01:00 (Migrated from code.blicky.net)
Copy link

I'm alright with a move to trash feature, but the biggest challenge is finding where and how to store that trash in some sort of standard way - as usual, too many standards.

Your patch defers that to glib, but I really do not want ncdu to link to a big library like glib in any way. The only real alternative is to write our own non-standard trash approach or find a tiny (optionally vendor-able) C lib to link to, but I'm not sure one exists. (I have experience with statically linking glib for ncdc, it's a pain)

Other than that, I was hoping to use 'D' for a 'delete contents of current directory' feature, but key bindings won't be a blocker.

I'm alright with a move to trash feature, but the biggest challenge is finding where and how to store that trash in some sort of standard way - as usual, too many standards. Your patch defers that to glib, but I really do not want ncdu to link to a big library like glib in any way. The only real alternative is to write our own non-standard trash approach or find a tiny (optionally vendor-able) C lib to link to, but I'm not sure one exists. (I have experience with statically linking glib for [ncdc](/yorhel/ncdc), it's a pain) Other than that, I was hoping to use 'D' for a 'delete contents of current directory' feature, but key bindings won't be a blocker.
SUPERCILEX commented 2022年12月21日 07:39:25 +01:00 (Migrated from code.blicky.net)
Copy link

tiny (optionally vendor-able) C lib to link to, but I'm not sure one exists

Yeah, I search quite a bit for this and couldn't find one. There's a Rust implementation, but last time I checked it didn't work 100% right because the "Trashed on" date was missing. I'm also not a big fan of pulling in glib, but that seemed most correct.

Feel free to reject this PR if you think we'll end up having to do a Zig re-implementation, I mainly wanted to get a patch up I could use for myself lol.

I was hoping to use 'D' for a 'delete contents of current directory' feature, but key bindings won't be a blocker.

Yup, no preferences here but had to pick something. :) We could go with w for waste.

> tiny (optionally vendor-able) C lib to link to, but I'm not sure one exists Yeah, I search quite a bit for this and couldn't find one. There's a [Rust implementation](https://github.com/Byron/trash-rs), but last time I checked it didn't work 100% right because the "Trashed on" date was missing. I'm also not a big fan of pulling in glib, but that seemed most correct. Feel free to reject this PR if you think we'll end up having to do a Zig re-implementation, I mainly wanted to get a patch up I could use for myself lol. > I was hoping to use 'D' for a 'delete contents of current directory' feature, but key bindings won't be a blocker. Yup, no preferences here but had to pick something. :) We could go with `w` for waste.
yorhel commented 2022年12月21日 07:42:43 +01:00 (Migrated from code.blicky.net)
Copy link

Thinking out loud, maybe it's better to not implement the full complexity of a trash feature, but instead provide the infrastructure and tooling for the user to set their own policies. #165 for example could easily be used for either deferred deletion or move-to-trash.

Closing this PR for now, then.

Thinking out loud, maybe it's better to not implement the full complexity of a trash feature, but instead provide the infrastructure and tooling for the user to set their own policies. #165 for example could easily be used for either deferred deletion or move-to-trash. Closing this PR for now, then.
SUPERCILEX commented 2022年12月21日 07:47:53 +01:00 (Migrated from code.blicky.net)
Copy link

Ooooh, yeah that'd be cool. A similar idea would be to let the user supply a command to be invoked on every "file action" (basically just a shortcut that will run the user supplied command) and then you pass in the file name either as an arg or on stdin. Then I could just pass in gio trash or #165 could append them to a file.

Ooooh, yeah that'd be cool. A similar idea would be to let the user supply a command to be invoked on every "file action" (basically just a shortcut that will run the user supplied command) and then you pass in the file name either as an arg or on stdin. Then I could just pass in `gio trash` or #165 could append them to a file.

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No reviewers
No labels
1.x
2.x
bug
feature
imported
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
selfisekai/ncsu!217
Reference in a new issue
selfisekai/ncsu
No description provided.
Delete branch "trash"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?