Skip to content

Add --prune to hide empty directories when filtering#48

Merged
peteretelej merged 1 commit into
mainfrom
feat/prune
Jan 4, 2026
Merged

Add --prune to hide empty directories when filtering#48
peteretelej merged 1 commit into
mainfrom
feat/prune

Conversation

@peteretelej

Copy link
Copy Markdown
Owner

When using --pattern or --exclude, tree returns empty directories in the listing. This is a bug in the linux tree https://linux.die.net/man/1/tree. Arch Linux's tree supports --prune to allow exclusion of such empty directories as documented here: https://man.archlinux.org/man/tree.1.en#BUGS_AND_NOTES

This change adds similar functionality.

# --prune will hide empty directories
./tree --pattern="*.txt" --exclude="*.log" --prune .

Resolves #36

@peteretelej peteretelej added the enhancement New feature or request label Jan 4, 2026
@codecov

codecov Bot commented Jan 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.54545% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.23%. Comparing base (9026f3e) to head (1ae484d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/rust_tree/traversal.rs 54.08% 45 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
- Coverage   80.84%   78.23%   -2.61%     
==========================================
  Files           7        7              
  Lines         804      873      +69     
==========================================
+ Hits          650      683      +33     
- Misses        154      190      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@peteretelej peteretelej added the bug Something isn't working label Jan 4, 2026
@peteretelej
peteretelej merged commit 0517785 into main Jan 4, 2026
9 checks passed
@peteretelej
peteretelej deleted the feat/prune branch January 4, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--pattern filtering does not prune directories

1 participant