feat: add --prune-empty-dirs flag to remove empty directories regardless of age#314
feat: add --prune-empty-dirs flag to remove empty directories regardless of age#314
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
💡 Tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions ✨No code suggestions found for the PR. |
|



User description
Summary
This PR adds a new flag
--prune-empty-dirs(default: false) that allows users to remove empty directories even if they are not considered stale.Changes
rmstale.go:pruneEmptyDirsflag.procDirandhandleEmptyDirectorysignatures to propagate the flag.handleEmptyDirectorylogic to remove directory if empty andpruneEmptyDirsis set, OR if it matches existing stale criteria.rmstale_test.go:procDirandhandleEmptyDirectoryto match new signatures.TestPruneEmptyDirsOptionto verify the new behavior.Issue
Fixes #296
PR Type
Enhancement, Tests
Description
Add
--prune-empty-dirsflag to remove empty directoriesUpdate
procDirandhandleEmptyDirectoryfunctions to support new flagImplement tests for
--prune-empty-dirsfunctionalityDiagram Walkthrough
File Walkthrough
rmstale.go
Add and integrate `pruneEmptyDirs` flag in main logicrmstale.go
pruneEmptyDirsflag to command-line optionsprocDirfunction signature to includepruneEmptyDirshandleEmptyDirectorylogic to usepruneEmptyDirsrmstale_test.go
Add tests for `--prune-empty-dirs` functionalityrmstale_test.go
pruneEmptyDirsflagTestPruneEmptyDirsOptionto verify new behavior