2
3
Fork
You've already forked ncsu
0

WIP: Implement trash functionality for file deletion and update delete confirmation options. #265

Closed
ivanstepanovftw 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
ivanstepanovftw commented 2025年07月09日 21:58:49 +02:00 (Migrated from code.blicky.net)
Copy link

Closes #215.

Deletion dialogue now looks like that, with first selected option "no" (as usual):

┌───Confirm delete─────────────────────────────────────────┐
│ Are you sure you want to delete "zig-spi...st-executor" │
│ and all of its contents? │
│ │
│ delete trash no always trash always delete │
└──────────────────────────────────────────────────────────┘

Trash specification to comply: https://specifications.freedesktop.org/trash-spec/latest/

Note this requires datetime module dependency, which std does not have.

Looking forward for your feedback on this approach!

Tested using Zig 0.14.1

Please, do NOT merge yet.

Closes #215. Deletion dialogue now looks like that, with first selected option "no" (as usual): ``` ┌───Confirm delete─────────────────────────────────────────┐ │ Are you sure you want to delete "zig-spi...st-executor" │ │ and all of its contents? │ │ │ │ delete trash no always trash always delete │ └──────────────────────────────────────────────────────────┘ ``` Trash specification to comply: https://specifications.freedesktop.org/trash-spec/latest/ Note this requires datetime module dependency, which std does not have. Looking forward for your feedback on this approach! Tested using Zig 0.14.1 Please, do NOT merge yet.
yorhel commented 2025年07月10日 08:59:03 +02:00 (Migrated from code.blicky.net)
Copy link

Hmm no, I still believe https://code.blicky.net/yorhel/ncdu/pulls/217#issuecomment-1307 is the better approach.

Hmm no, I still believe https://code.blicky.net/yorhel/ncdu/pulls/217#issuecomment-1307 is the better approach.
ivanstepanovftw commented 2025年07月10日 14:02:00 +02:00 (Migrated from code.blicky.net)
Copy link

Do you have specifications for this approach? How those policies should look like when implemented?

Freedesktop.org Trashing specification is literally deferred deletion with common accepted specification that follow many software including baobab, vscode, etc. Trashing does not require you to implement queue list or something like that.

Lets imagine you have this "policy feature". What if ncdu abruptly exited, i.e. when ssh connection lost? You will loose paths you want to delete, because runtime does not exist anymore. You will have to re-scan, find these files you want to delete and "delete" again. What if deletion did not happen, because user policy for them is to "print after exit", should those paths gone from the scan interface? What about duplicates? User may face "cannot delete" errors... How even this pipeline should look like from the user's perspective?

I want trashing feature in ncdu because I do not want to delete. I do not want to think of consequences every time I press "d", I want to delay the deletion.

Trashing spec exist for a reason.

If you do not want to see my name in the SPDX headers - feel free to remove them after I finish this pull request. I will accept that as a punishment for contributing to open source.

Looking forward for your reply!

Do you have specifications for this approach? How those policies should look like when implemented? Freedesktop.org Trashing specification is literally deferred deletion with common accepted specification that follow many software including baobab, vscode, etc. Trashing does not require you to implement queue list or something like that. Lets imagine you have this "policy feature". What if ncdu abruptly exited, i.e. when ssh connection lost? You will loose paths you want to delete, because runtime does not exist anymore. You will have to re-scan, find these files you want to delete and "delete" again. What if deletion did not happen, because user policy for them is to "print after exit", should those paths gone from the scan interface? What about duplicates? User may face "cannot delete" errors... How even this pipeline should look like from the user's perspective? I want trashing feature in ncdu because I do not want to delete. I do not want to think of consequences every time I press "d", I want to delay the deletion. Trashing spec exist for a reason. If you do not want to see my name in the SPDX headers - feel free to remove them after I finish this pull request. I will accept that as a punishment for contributing to open source. Looking forward for your reply!
yorhel commented 2025年07月15日 18:28:19 +02:00 (Migrated from code.blicky.net)
Copy link

Implemented in the form of 66b875eb00

Implemented in the form of 66b875eb0076e24146d3ac4f90571595c960484e

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!265
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?