feat: move items to XDG trash with D key (#12) - #608
Open
phaethix wants to merge 11 commits into
Open
Conversation
Introduce DeleteAction to model delete/empty/trash removal modes and thread it through the TUI delete pipeline ahead of move-to-trash support. Co-authored-by: Cursor <cursoragent@cursor.com>
Implement XDG trash move on Unix with name-conflict handling and cross-device fallback; stub on Windows. Includes unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Connect ActionMoveToTrash to ui.trasher (default remove.MoveItemToTrash), bind uppercase D in the main key handler, and document it in help. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Cover D-key trash action via trasher spy and assert help text shows the trash line enabled and disabled under SetNoDelete. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Use exclusive trashinfo creation and reserved names for concurrent moves, and reject FIFOs and other non-regular files during cross-device copy to avoid hangs. Co-authored-by: Cursor <cursoragent@cursor.com>
Use RENAME_NOREPLACE on Linux and a preflight check elsewhere, and retry with a new reserved name if the destination appears after trashinfo creation. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #608 +/- ##
==========================================
+ Coverage 85.89% 86.38% +0.49%
==========================================
Files 55 59 +4
Lines 6329 6487 +158
==========================================
+ Hits 5436 5604 +168
+ Misses 689 681 -8
+ Partials 204 202 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Make DeleteAction switches list ActionDelete explicitly, name reserveTrashInfo results, and write trashinfo via WriteString. Co-authored-by: Cursor <cursoragent@cursor.com>
Exercise EXDEV fallback, escape encoding, trashdir defaults, retries, marked/background trash paths, and DeleteAction string helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
Inject filesystem operations so failure branches can be tested deterministically, and cover archive and confirmation behavior to keep all modified lines exercised. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dto move selected/marked items into FreeDesktop XDG trash ($XDG_DATA_HOME/Trash, else~/.local/share/Trash), keepingd= permanent delete ande= empty.DeleteActionthrough the TUI delete pipeline and implementsremove.MoveItemToTrashwith exclusive.trashinforeservation, cross-device copy fallback, symlink/FIFO-safe handling, and no-clobber rename.--no-delete/archive guards match existing delete behavior.Closes #12
Test plan
go test ./pkg/remove/ ./tui/GOOS=windows/GOOS=linuxforpkg/removeDon a file, confirm it appears under$XDG_DATA_HOME/Trash/{files,info}Trash/files/<name>already exists → lands as<name>.2without overwriting?help showsD; with--no-delete, trash is disabled like delete/emptyMade with Cursor