-
-
Notifications
You must be signed in to change notification settings - Fork 797
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: limit the number of find result #476
Comments
Would fd … | head -n 30 work for you? If you want colorized output, you can use fd --color=always … | head -n 30 |
see also my answer in #472. |
Good idea. It works on macOS. But on windows, there is no 'head' command. I would have to install msys2 to use it. |
I'd like to close this in favor of #472 (even if this is slightly more general). It's not very likely that we will implement a separate command-line option for this, given that there are reasonable alternatives. |
This new option can be used instead of piping to `head -n <count>` for improved performance: | Command | Mean [ms] | Min [ms] | Max [ms] | Relative | |:---|---:|---:|---:|---:| | `fd --max-buffer-time=0 flow.yaml` | 153.9 ± 2.5 | 151.3 | 170.3 | 4.21 ± 5.86 | | `fd --max-buffer-time=0 flow.yaml \| head -n 1` | 145.3 ± 17.4 | 111.0 | 180.2 | 3.98 ± 5.55 | | `fd --max-results=1 flow.yaml` | 36.5 ± 50.8 | 7.2 | 145.7 | 1.00 | Note: there is a large standard deviation on the last result due to the non-deterministic file system traversal. With `--max-results`, we don't have to traverse the whole filesystem tree, so it's all about luck. closes #472 closes #476
This new option can be used instead of piping to `head -n <count>` for improved performance: | Command | Mean [ms] | Min [ms] | Max [ms] | Relative | |:---|---:|---:|---:|---:| | `fd --max-buffer-time=0 flow.yaml` | 153.9 ± 2.5 | 151.3 | 170.3 | 4.21 ± 5.86 | | `fd --max-buffer-time=0 flow.yaml \| head -n 1` | 145.3 ± 17.4 | 111.0 | 180.2 | 3.98 ± 5.55 | | `fd --max-results=1 flow.yaml` | 36.5 ± 50.8 | 7.2 | 145.7 | 1.00 | Note: there is a large standard deviation on the last result due to the non-deterministic file system traversal. With `--max-results`, we don't have to traverse the whole filesystem tree, so it's all about luck. closes #472 closes #476
This has actually been implemented as |
Thanks. |
@sharkdp great news, thanks for implementing this feature! 👍 What do you think about making it a one-line option |
thank you for the feedback.
I'd rather not, at least not right away. Let's see how this feature develops for some time. What is your most common use case of |
Indeed it's quite often just a single file. I use such
That's a really good idea! |
see #561 |
This has now been released in fd v8.0. |
When used with emacs helm, fd process is created after every char inputting. I want to limit the number of the find result, because the extra results have no use and just cost power.
If there are too many results (more than 100 for me), I will find again until the results are less than 30. This is my common use(99%).
The text was updated successfully, but these errors were encountered: