With an empty pattern, --glob results in no matches. This does not
align with the behavior of --fixed-strings or --regex. Update the
initialization code to handle globs with empty patterns.
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#472closes#476
If `/dev/null` doesn't exist or is not on a different partition during
the test for `--one-file-system`, the test is skipped instead of
mistakenly failing.
Add a new `empty`/`e` type to search for empty files and/or directories.
To search for both empty files and directories, use one of the
following:
fd --type empty
fd -te
fd --type empty --type file --type directory
To search for empty files, use
fd --type empty --type file
fd -te -tf
To search for empty directories, use
fd --type empty --type directory
fd -te -td
closes#273
* Replace usage of `-exec` by `--exec`, except when it is used as a value that is given to `--exec/-exec/-x`.
* Limit usage of --exec option to single instance.
* Adding support for multiple paths. (panic)
- Started adding multiple file support
- fd panics with multiple files right now
* Moved the ctrlc handler to main.
- Moved the ctrlc handler to main so we can search multiple files
* Tests now allow custom directory setup
- TestEnv::new() now takes two arguments, the directories to create and
the files to create inside those directories.
* rust-fmt changes
* rust-fmt changes
* Moving code around, no need to do everything in one big loop
- PathDisplay was never actually used for anything, removed it during refactor of main
- Removed redundant logic for absolute paths
- Moved code placed needlessly inside a loop in the last commit outside of that loop.
* Moving code around, no need to do everything in one big loop
- PathDisplay was never actually used for anything, removed it during refactor of main
- Removed redundant logic for absolute paths
- Moved code placed needlessly inside a loop in the last commit outside of that loop.
* Removed commented code in testenv
* Refactored walk::scan to accept the path buffer vector. Using the ParallelWalker allows for multithreaded searching of multiple directories
* Moved ctrlc handler back into walker, it is only called once from main now.
* Moved the colored output check back to it's original place
* Removing shell-escape, not sure how it got added...
* Added test for `fd 'a.foo' test1` to show that a.foo is only found in the test1 and not the test2 direcotry
* Removing side effect from walk::scan, `dir_vec` is no longer a mutable reference and an iterator is being used instead.
* Running rustfmt to format code correctly
Previously, we were using the relative path to extract the search
string. For the current directory, the returned relative path was equal
to `""`. This is why the current directory did not show in the search
results (see #81).
This commit also changes the way that `--full-path` works, which was
previously working on relative paths. It seems more useful to search the
absolute path, though. Otherwise, search results could change just by
calling fd (with a given search path) from a different directory.
* Rewrite integration tests in Rust.
* Improve failure output for integration tests.
* Move TestEnv to separate module.
* Remove old integration tests script.
* Re-add integration test for subdirectory.