Commit Graph

37 Commits

Author SHA1 Message Date
binlingyu 7794c4aae5 Use 'MAIN_SEPARATOR_STR' instead of '&MAIN_SEPARATOR.to_string()' 2024-04-15 10:36:10 +08:00
Thayne McCombs fd707b42c2 Add tests for global ignore file 2022-12-18 00:42:54 -07:00
Thayne McCombs 650a511fa4 Use tempfile instead of tempdir
Because tempdir is no longer maintained, because it has been combined
with the tempfile crate.

Relates-To: #1188
2022-11-30 02:26:16 -07:00
Thayne McCombs 38d406876d Fix a couple small clippy warnings
- suppress warning about unused function on windows
- remove extraneous & in test
2022-11-11 02:12:58 -07:00
Sijmen 922f127aca Add test when running from non-existent directory
When fd is run from a non-existent directory, but a search path is
passed in the arguments, it should still run. This tests for that.
2022-08-10 20:01:21 +02:00
Thayne McCombs 43f276e073 Upgrade to clap 3.0
This wasn't backwards compatible so required some more substantial
changes.
2022-01-07 23:56:03 -07:00
Thayne McCombs 06cd391845 Change test_opposing to be less flaky.
Make it resilient to the different invocations returning results in
different orders.
2022-01-07 03:10:09 -07:00
David Peter 2a2126c40a Fix clippy warnings 2021-07-27 09:05:23 +02:00
David Peter e0adb45d08
Fail with error message if numeric arguments can not be parsed
closes #675
2020-10-25 21:18:53 +01:00
sharkdp 726fede7cc Code formatting 2020-05-19 15:57:47 +02:00
DJRHails da9af8c1eb Improve consistency of linting 2020-05-19 15:57:47 +02:00
DJRHails bbf3d0d430 Update testenv to support errors that don't fail 2020-05-19 15:57:47 +02:00
Bobbie Soedirgo 79d5a5bdc5 Add global fdignore support 2020-05-18 21:19:09 +02:00
sharkdp ed024ceb54 Remove code duplication, add feature gate 2020-04-04 18:46:08 +02:00
sharkdp ea21df3f76 Add tests originally written by @alexmaco in #309 2020-04-04 18:46:08 +02:00
sharkdp 53557ef471 Clean up include order 2020-04-03 22:36:32 +02:00
sharkdp 4274075f6f Remove outdated license headers (not strictly required by Apache-2.0) 2020-04-03 10:19:13 +02:00
sharkdp d43827fe57 Add --max-results=<count> option
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
2020-04-02 20:27:41 +02:00
Tom Milligan 06434f229b test: we should find broken symlink with and without --follow 2020-02-28 20:42:14 +01:00
Tim Holland 074cfad3d4 Remove deprecated trim_left(_matches)?
warning: use of deprecated item 'core::str::<impl str>::trim_left_matches': superseded by `trim_start_matches`
   --> src/main.rs:222:28
    |
222 |                 .map(|e| e.trim_left_matches('.'))
    |                            ^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(deprecated)] on by default
2019-03-02 08:15:12 +01:00
Alexandru Macovei 051ff5987a [2018 edition] remove all extern crate lines from sources 2019-01-07 12:52:30 +01:00
kimsnj 6b40a075cd exec-batch: fix a panic with -X "echo {}" and pass stdio to child cmd 2018-11-12 21:11:40 +01:00
kimsnj 45d1b15cff Add support for batch execution of command 2018-11-12 21:11:40 +01:00
sharkdp 27caa33729 cargo fmt 2018-09-27 23:01:38 +02:00
sharkdp c428f52209 Run cargo fmt 2018-08-03 21:20:48 +02:00
sharkdp 59c9901cde Update dependencies, fix #313 2018-08-03 21:20:48 +02:00
sharkdp c1ef68662c Update for new rustfmt 2018-05-14 21:00:00 +02:00
sharkdp b4be1f161c Add support for .fdignore files 2018-02-21 22:55:26 +01:00
sharkdp a5f5ad6254 Re-enable code style check 2018-01-01 16:00:32 +01:00
Dock 51aea57a6a Add multiple path support (#182)
* 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
2017-12-06 14:52:23 -08:00
ptzz 9bd1d12c00 Add --no-ignore-vcs option
When passed, .gitignore files will not be respected.
2017-11-22 23:18:22 +01:00
J.W d702d849ea Test --exec on Unix 2017-10-26 20:56:32 +02:00
Antti Keränen 701b8f209b Relicense under MIT/Apache-2.0 2017-10-22 10:36:42 +02:00
J.W 8d85debc12 Refactor path handling (fixes #113)
* Fix path check
* Fix full path matching
* Allow more simple driver names in Windows tests
* Factor out special is_dir() check for "." and ".."
2017-10-18 20:04:34 +02:00
Antti Keränen 049b9ec06b Format the source code using `rustfmt` 2017-10-12 19:33:14 +02:00
David Peter 4731dc670c Enhanced Windows support, see #70
* Use easier way to convert path components
* Fix failing tests on Windows
2017-10-07 09:40:44 +02:00
Matthias Reitinger 6f22957cdc Re-write integration tests in Rust (#67)
* 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.
2017-10-04 23:19:30 +02:00