The Wayback Machine - https://web.archive.org/web/20200617042417/https://github.com/sharkdp/fd/issues/535
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

`-prune` options #535

Open
std-odoo opened this issue Feb 13, 2020 · 8 comments
Open

`-prune` options #535

std-odoo opened this issue Feb 13, 2020 · 8 comments

Comments

@std-odoo
Copy link

@std-odoo std-odoo commented Feb 13, 2020

Is it possible to add an option -prune, to not explore sub-directories, when the current directory has been matched ? (like find -prune)

@sharkdp
Copy link
Owner

@sharkdp sharkdp commented Feb 16, 2020

Thank you for your feedback. Can you please give us some examples of actual (non-hypothetical) use cases for this?

@std-odoo
Copy link
Author

@std-odoo std-odoo commented Feb 17, 2020

@sharkdp Yes of course :)
I'm developing a package for sublime text, and I'm using your tool
https://github.com/Mister7F/Sublime-DirectoryFilter

I don't want to display a directory if one of the parent directory has matched the search :)

With the find tool, I can use the option prune, but as your tool is faster, I use it, and I prune the directory manually, in python.

@sharkdp
Copy link
Owner

@sharkdp sharkdp commented Feb 28, 2020

Ok, let's try to implement this as a new flag. We can hide it from the short -h help text.

@neuronull
Copy link

@neuronull neuronull commented Mar 12, 2020

Hello. I'd like to take this if its available?

@neuronull
Copy link

@neuronull neuronull commented Mar 12, 2020

Clarification on behavior: is prune meant to be a flag to operate on <pattern>?
for example:

$ tree
.
├── bar
│   └── zap
│       ├── foo
│       └── zig
└── foo
    ├── bar
    └── foo

$ fd foo
bar/zap/foo
foo
foo/foo

$ fd --prune foo
bar/zap/foo
foo
@std-odoo
Copy link
Author

@std-odoo std-odoo commented Mar 12, 2020

Yes :) it should work like this (the tool should stop to explore sub-directories when the current directories has matched)

neuronull added a commit to neuronull/fd that referenced this issue Mar 13, 2020
- Added --prune option which will not descend into directories
  that are a match on pattern.
- Added test to cover --prune option.
@sharkdp
Copy link
Owner

@sharkdp sharkdp commented Mar 28, 2020

@std-odoo Maybe you could help out with the design decisions in #546?

@jonathan-s
Copy link

@jonathan-s jonathan-s commented Jun 8, 2020

I'm happy to see that this is in the works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.