Commit graph

110 commits

Author SHA1 Message Date
Allen Wild
8a532e5196 use custom --path-separator in arguments to --exec
When --path-separator is used, pass it on to commands run with
--exec(-batch) and --list-details.

On Windows, paths with drive letters (C:\foo) and UNC paths
(\\server\share\path) are handled as expected, though they're unlikely
to be found in normal usage of fd.

Fixes: https://github.com/sharkdp/fd/issues/697
2021-02-14 10:24:41 +01:00
sharkdp
cadaef3f07 Show error if pattern matches leading dot but --hidden is not given, closes #615 2020-12-06 15:57:33 +01:00
sharkdp
d2659de782 Improve --extension help text, closes #673 2020-12-06 12:20:50 +01:00
Platon Pronko
e97a1e90cb Add exact size support to the --size filter (#669) 2020-12-06 11:47:27 +01: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
Matthias Reitinger
ec4cc981fc
Add --prune flag
closes #535
2020-10-25 08:16:01 +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
dc120c547d Add error checking on missing test case 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
DJRHails
fef1b91feb Remove test assertion covered by existing tests 2020-05-19 15:57:47 +02:00
DJRHails
ca2ef7ba82 Add a test for a single missing search path 2020-05-19 15:57:47 +02:00
Bobbie Soedirgo
79d5a5bdc5 Add global fdignore support 2020-05-18 21:19:09 +02:00
Alexandru Macovei
4f4330167a Fix some clippy lints, and format 2020-05-01 14:08:53 +02:00
Seamus Connor
b22285ffe4 Fix --glob behavior with empty pattern
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.
2020-04-26 22:01:29 +02:00
sharkdp
4287cddc00 Add test 2020-04-15 23:32:28 +02:00
sharkdp
d63c63be8c Add --min-depth and --exact-depth
Add new `--min-depth <depth>` and `--exact-depth <depth>` options in addition to the existing
option to limit the maximum depth.

closes #404
2020-04-15 17:02:41 +02:00
sharkdp
47974b6479 --glob: '*' does not match on path separators 2020-04-15 16:41:56 +02:00
Danny Mösch
2bab4a2249 Add alias -1 for --max-results=1 2020-04-10 21:39:30 +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
342d12db3f Remove possibility to use '--exec <cmd>' with a single dash 2020-04-03 22:36:32 +02:00
sharkdp
289d6443a7 Use .write_all 2020-04-03 10:37:53 +02:00
sharkdp
4274075f6f Remove outdated license headers (not strictly required by Apache-2.0) 2020-04-03 10:19:13 +02:00
sharkdp
1714d416e2 Fix test on Windows 2020-04-02 20:27:41 +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
sharkdp
918dfc6ef0 Add expected behavior as unit tests 2020-02-28 20:42:14 +01:00
Tom Milligan
06434f229b test: we should find broken symlink with and without --follow 2020-02-28 20:42:14 +01:00
sharkdp
328c6640be Formatting 2020-01-01 12:05:33 +01:00
Simon Engmann
9a34ba6a0c Credit the source of the device_num() function 2020-01-01 11:54:01 +01:00
Simon Engmann
2828d90f99 Don't assume that /dev/null exists in test
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.
2020-01-01 11:54:01 +01:00
Simon Engmann
94993ca6c2 Rename --same-file-system to --one-file-system 2020-01-01 11:54:01 +01:00
Simon Engmann
3e0325cc60 Adjust tests to not time out on Travis OSX 2020-01-01 11:54:01 +01:00
Simon Engmann
e5ba75f3c8 Add tests for --same-file-system 2020-01-01 11:54:01 +01:00
Rafał Hajdacki
fb205f5057 Allow changing current working directory of fd 2019-12-23 15:42:33 +01:00
sharkdp
50fca2dca2 Disable full-path glob test on Windows 2019-09-15 16:47:38 +02:00
sharkdp
588888112a Adapt full-path glob test for Windows 2019-09-15 16:47:38 +02:00
sharkdp
eac20a8132 Add --regex option to override --glob 2019-09-15 16:47:38 +02:00
sharkdp
d5da615c17 Implement glob-based searches
closes #284
2019-09-15 16:47:38 +02:00
David Peter
3599a30ee2
Support FILE_ATTRIBUTE_HIDDEN on Windows (#478) 2019-09-15 12:41:04 +02:00
Nathan Moreau
761c445263 Add a non regression test. 2019-09-15 10:57:27 +02: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
Alexandru Macovei
64e6ea9fe9 [2018 edition] run cargo fix edition and edition-idioms 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
deea31cbbc Add aliases, change help text 2018-10-27 15:34:10 +02:00
Karim SENHAJI
abe8aa55c0 clean-up first implementation of modification date filter 2018-10-10 19:52:37 +02:00
Karim SENHAJI
54c117d72f Add support for --changed-before and --changed-with for modification time based search 2018-10-10 19:52:37 +02:00