Commit graph

620 commits

Author SHA1 Message Date
Thayne McCombs
27c6b50919 Fix a new clippy warning 2024-09-23 09:42:58 +02:00
Ross Smyth
80a73fda49 Fix unused config struct field on Windows 2024-07-22 10:02:08 -04:00
Ross Smyth
db9d2fa299 Fix unused OnceLock import lint on Windows 2024-07-22 10:02:05 -04:00
Thayne McCombs
45d6fbb9e2 Fix percent encoding
When the first digit is 0
2024-06-24 00:39:41 -06:00
Thayne McCombs
b1f7aef00b Change --hyperlink to be an option instead of a flag 2024-06-11 00:38:01 -06:00
Thayne McCombs
d8d2c37ec0 Fix test on windows 2024-06-10 00:55:10 -06:00
Thayne McCombs
609f1adf90 Fix unicode encoding of hyperlinks
The problem, is I based the code on the implementation in ripgrep. But
while ripgrep is writing directly to the stream, I am using a Formatter,
which means I have to write characters, not raw bytes.

Thus we need to percent encode all non-ascii bytes (or we could switch
to writing bytes directly, but that would be more complicated, and I
think percent encoding is safer anyway).
2024-06-09 22:57:00 -06:00
Thayne McCombs
bd649e2fd7 Add hyperlink support to fd
Fixes: #1295
Fixes: #1563
2024-06-08 23:38:57 -06:00
Thayne McCombs
d44badc190 Implement option for printing custom formats 2024-05-07 22:52:49 -06:00
Thayne McCombs
b1f83a0bb0 feat: Add option to always include cwd prefix
Fixes: #1243
Fixes: #1331
2024-05-07 00:24:06 -06:00
Thayne McCombs
a0ee0856db Add @timestamp to --help 2024-05-05 23:52:50 -06:00
Thayne McCombs
6647085015 Add test for gitignore workaround
And make sure it works for user-supplied path of "."

Also add changelog entry
2024-04-30 15:56:12 +02:00
Thayne McCombs
6af8f092ee Workaround for bug with gitinored files
This is a workaround for
https://github.com/BurntSushi/ripgrep/issues/2711

Fixes: #1461
2024-04-30 15:56:12 +02:00
Thayne McCombs
e10a4eab2b Stop ignore .git folders by default
Fixes: #1457
See: #1396, #1403
2024-04-28 20:23:25 -06:00
Tavian Barnes
1031325cca filesystem: Remove a redundant as_str() 2024-04-28 17:30:44 -04:00
Tavian Barnes
9fc2167cf9
Merge pull request #1505 from leuven65/master
set default path separator to '/' in UCRT64 of MSYS
2024-04-28 17:23:43 -04:00
Thayne McCombs
7e5d14b733 Fix deprecation warning. 2024-04-27 21:58:54 -06:00
Thayne McCombs
85cbea8dcb
Merge pull request #1494 from nabellows/master
Add support for @%s time format
2024-04-26 22:37:54 -06:00
binlingyu
7794c4aae5 Use 'MAIN_SEPARATOR_STR' instead of '&MAIN_SEPARATOR.to_string()' 2024-04-15 10:36:10 +08:00
Jian Wang
f875ea9a52 Set default path separator to '/' in MSYS/MSYS2
The environments of MSYS: [[https://www.msys2.org/docs/environments/]]
2024-03-13 19:32:13 +01:00
one230six
138919907b refactor: Optimize code based on cargo clippy suggestions
Signed-off-by: one230six <723682061@qq.com>
2024-03-13 15:37:24 +08:00
garlic-hub
0788c43c3f
Clean up clippy warnings 2024-03-08 10:46:24 -08:00
Nathan Bellows
ffde94c10e Run formatting 2024-02-12 02:12:58 -08:00
Nathan Bellows
b0a8848f68 Add support for @%s time format 2024-02-12 02:05:41 -08:00
Alexandru-Constantin Atomei
3cb6b9d93a Updated CHANGELOG.md, man page and made alias visible in fd -h too 2024-01-01 17:14:32 +02:00
Atomei Alexandru
c591106b86
Merge branch 'master' into dir_alias 2023-12-30 22:58:10 +02:00
Alexandru-Constantin Atomei
9f096737db Added explicit documentation about the possibility of using dir 2023-12-30 22:54:57 +02:00
Alexandru-Constantin Atomei
1bda165b25 Added alias --type dir 2023-12-30 22:14:53 +02:00
Thayne McCombs
9529f30129 fix: Respect NO_COLOR with --list-details option
Fixes: #1455
2023-12-23 21:32:33 +01:00
Tavian Barnes
16c2d1e1d0 walk: Flush stdout in batches
The previous behaviour was designed to mimic the output buffering of
typical UNIX tools: line-buffered if stdout is a TTY, and fully-buffered
otherwise.  More precicely, when printing to a terminal, fd would flush
explicitly after printing any buffered results, then flush after every
single result once streaming mode started.  When not printing to a
terminal, fd never explicitly flushed, so writes would only happen as
the BufWriter filled up.

The new behaviour actually unifies the TTY and non-TTY cases: we flush
after printing the buffered results, then once we start streaming, we
flush after each batch, but *only when the channel is empty*.  This
provides a good balance: if the channel is empty, the receiver thread
might as well flush before it goes to sleep waiting for more results.
If the channel is non-empty, we might as well process those results
before deciding to flush.

For TTYs, this should improve performance by consolidating write() calls
without sacrificing interactivity.  For non-TTYs, we'll be flushing more
often, but only when the receiver would otherwise have nothing to do,
thus improving interactivity without sacrificing performance.  This is
particularly handy when fd is piped into another command (such as head
or grep): with the old behaviour, fd could wait for the whole traversal
to finish before printing anything.  With the new behaviour, fd will
print those results soon after they are received.

Fixes #1313.
2023-12-18 22:01:11 +01:00
Tavian Barnes
fea1622724 cli: Tweak default thread count logic 2023-12-18 21:55:18 +01:00
Tavian Barnes
b8a5f95cf2 walk: Limit batch sizes in --exec mode 2023-11-28 15:51:33 -05:00
Tavian Barnes
73260c0e35 walk: Send WorkerResults in batches 2023-11-28 15:51:33 -05:00
Lena
ad5fb44ddc
fix: display color when NO_COLOR is an empty string 2023-11-04 15:07:10 +01:00
Tavian Barnes
8bbbd7679b walk: New WorkerState struct shared by the worker threads 2023-11-02 17:07:38 +01:00
Thayne McCombs
5ee6365510 Set maximum default threads
Set a limit of how many threads fd will use by default. On hosts that
have a large number of cores, using additional threads has diminishing
returns, and having large numbers of threads increases the setup cost.
Thus we don't necessarily want to use the same number of threads as we
have cores.

Fixes: #1203
2023-10-26 00:48:30 -06:00
Thayne McCombs
1d57b3a064 Simplify parsing number of threads. 2023-10-25 23:56:59 -06:00
Thayne McCombs
325d419e39 Replace num_cpus with std:🧵:available_parallelism
I think this might help startup time a little bit, since it looks like
on linux at least the std implementation uses syscalls to determine the
parallelism, whereas num_cpus was processing the /proc/cpuinfo file.

It also removes another dependency.
2023-10-25 02:00:31 -06:00
João Marcos P. Bezerra
7263b5e01d Fix docs typos 2023-10-24 00:40:12 -03:00
Thayne McCombs
c6fcdbe000 docs: Explicitly warn against relying on result order for exec
Supersedes: #1230
Fixes: #1228
2023-10-23 08:34:15 +02:00
Thayne McCombs
08910e4e3f docs: Some tweaks from review 2023-10-23 08:34:03 +02:00
Thayne McCombs
53fd416c47 docs: Document exclusion of .git/ 2023-10-23 08:34:03 +02:00
Thayne McCombs
054bae01ef maint: Remove use of unmaintained users crate
The users crate is no longer maintained. There is a maintained fork
called uzers, but we already have a dependency on nix, and that has the
functionality we need.
2023-10-21 23:37:32 -06:00
David Peter
0fc8facfb7 Fix --help text 2023-10-21 22:16:15 +02:00
Thayne McCombs
069b181625 Fix documentation for brace escapes 2023-10-21 22:16:15 +02:00
Thayne McCombs
d9b69c8405 feat: Add a way to escape { and }in exec templates.
fixes #1303
2023-10-21 22:16:15 +02:00
Thayne McCombs
a11f8426d4 Fix deprecation warning from chrono
Also change logic to use the latest time if the local time is ambiguous
(for example due to daylight savings)
2023-10-21 14:07:50 +02:00
Christian Göttsche
36bc84041b Support character and block device file types 2023-10-21 13:56:33 +02:00
Thayne McCombs
3ed4ea7538
Merge pull request #1396 from skoriop/default-ignore-git-folder
feat: ignore `.git/` by default
2023-10-20 22:35:22 -06:00
Karthik Prakash
9df9a489f0 refactor: replace map_err with expect
Co-authored-by: Thayne McCombs <astrothayne@gmail.com>
2023-10-18 13:06:51 +05:30