Skip to content

feat: add --dry-run flag to preview files before deletion#322

Open
fuleinist wants to merge 1 commit intopashkov256:mainfrom
fuleinist:feat/dry-run
Open

feat: add --dry-run flag to preview files before deletion#322
fuleinist wants to merge 1 commit intopashkov256:mainfrom
fuleinist:feat/dry-run

Conversation

@fuleinist
Copy link
Copy Markdown

Summary

Implements a Dry-Run / Preview mode for the CLI as requested in issue #319.

What changed

Added flag that:

  • Previews files that would be deleted/trashed without modifying the filesystem
  • Skips the confirmation prompt when is set
  • Shows file count and total size of what would be deleted
  • Also handles empty folder deletion preview

Example usage

deletor -cli -d ~/Downloads -e mp4,zip --dry-run
# Output: [DRY-RUN] Would delete 12 file(s) (1.2 GB) from /home/user/Downloads

deletor -cli -d ~/Downloads -e mp4,zip --dry-run --trash
# Output: [DRY-RUN] Would delete 12 file(s) (1.2 GB) from /home/user/Downloads

Files changed

  • — added flag
  • — added field to Config
  • — added dry-run logic that skips actual deletion

Use case

Users can safely preview what would be deleted before running for real — helpful for automation scripts, debugging filters, and preventing accidental data loss.


Fixes #319

Adds --dry-run CLI flag for issue pashkov256#319:
- Previews files that would be deleted without modifying filesystem
- Skips confirmation prompt in dry-run mode
- Shows file count and total size in output
- Also handles empty folder deletion preview
- Works with both --trash and permanent deletion modes

Co-authored-by: fuleinist <fuleinist@outlook.com>
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

Successfully merging this pull request may close these issues.

Add Dry-Run / Preview mode (CLI + TUI)

1 participant