Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request:] Pruning (when filtering using glob, don't print the empty branches) #53

Closed
TomLebeda opened this issue Mar 11, 2023 · 2 comments · Fixed by #55
Closed

Comments

@TomLebeda
Copy link

TomLebeda commented Mar 11, 2023

I really like erdtree, here is little idea that I came across while using erdtree to search for files on my disk.

As the title says, it would be useful to enable "pruning" so the output only contains branches that aren't empty at the end.

Example:
let's say we have directory:

 folder_a
├─  folder_b
│  ├─  file_d (0.00 B)
│  ├─  file_c (0.00 B)
│  ├─  folder_ba
│  │  └─  file_x (0.00 B)
│  ├─  folder_bc
│  │  └─  file_z (0.00 B)
│  └─  folder_bb
│     └─  file_y (0.00 B)
├─  file_a (0.00 B)
├─  folder_c
│  ├─  file_ab (0.00 B)
│  ├─  file_ac (0.00 B)
│  ├─  file_ad (0.00 B)
│  ├─  file_f (0.00 B)
│  └─  file_e (0.00 B)
└─  file_b (0.00 B)


and I want to filter for files that contains "a": et -g "file_*a*" and the output is:

 folder_a
├─  folder_b
│  ├─  folder_bc
│  ├─  folder_ba
│  └─  folder_bb
├─  file_a (0.00 B)
└─  folder_c
   ├─  file_ab (0.00 B)
   ├─  file_ac (0.00 B)
   └─  file_ad (0.00 B)

but with the "pruning" enabled, it would skip the "dead-ends" and print just:

 folder_a
├─  file_a (0.00 B)
└─  folder_c
   ├─  file_ab (0.00 B)
   ├─  file_ac (0.00 B)
   └─  file_ad (0.00 B)

The idea is that when searching through bigger trees, the dead-ends are cluttering the output.

@solidiquis
Copy link
Owner

Sure thing; this doesn't sound too hard to implement. I'll be sure to include this in the next minor release before Monday :)

@solidiquis
Copy link
Owner

Will be included in next minor release later today :]

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 a pull request may close this issue.

2 participants