Commit Graph

612 Commits

Author SHA1 Message Date
Thayne McCombs 424d6efcc0 fix: Remove unnecessary collection into a vec. 2023-03-20 01:21:00 -06:00
Thayne McCombs ccf8e69650 fix: clippy warning for unnecessary closure
Now that MSRV is above 1.62, we can use `then_some` instead of a simple
closure.
2023-03-20 01:21:00 -06:00
Thayne McCombs ee44c1ed90 refactor: Use scoped threads from stdlib in spawn_receiver
This makes it so we don't need to use Arc as much.

Fixes #1141
2023-03-20 01:21:00 -06:00
David Peter 73a693ef28
Merge pull request #1244 from tmccombs/grouped-occurrences
update: Update to clap 4.1
2023-02-01 21:36:19 +01:00
Thayne McCombs 10ba34f78b update: Update to clap 4.1
This includes switching to the stable API for getting values grouped by
occurrences, and updating tests to match the new error messages.
2023-01-17 00:17:50 -07:00
Max 👨🏽‍💻 Coplan 08c0d427bf Add flag --no-require-git to always respect gitignore files
Summary: Currently, `--ignore-vcs` only serves to unset `--no-ignore-vcs`.
There is currently no way to tell fd to respect gitignore files when not in a
git repository.  This commit adds the flag `--no-require-git` to make fd always
respect all gitignore files.

This behaves the same as the `--no-require-git` option in [ripgrep](3bb71b0cb8/crates/core/app.rs (L2214-L2226))

This commit also contains an unrelated wording fix to CONTRIBUTING.md

Test Plan: `tests/tests.rs`

Background: I am using [Sapling](https://sapling-scm.com/docs/introduction/)
for working with git repositories (including this commit ☺️).  Since Sapling
uses `.sl` instead of `.git`, tools using the `ignore` crate (rg and fd) would show gitignored files.
I made a patch (ebf17eef22)
to `ignore` to respect gitignores with _either_ `.git` or `.sl`.  However,
@BurntSushi said he did not want to merge that patch and instead suggested I
use `--no-require-git` (https://github.com/BurntSushi/ripgrep/issues/2374).
This works fine, but I couldn't use this workaround for my other favorite tool!
That's what this patch is for 😁

(a follow-up patch will add a similar `FD_CONFIG_PATH` environment variable
like `RG_CONFIG_PATH`)
2023-01-13 13:52:34 -08:00
Thayne McCombs 27013537c9 Fix logic for when to read global ignore file
Fixes #1209
2022-12-17 00:28:47 -07:00
Thayne McCombs b7a2f68d59 Mention --changed-after alias in long help 2022-12-06 01:28:15 -07:00
Thayne McCombs e98a6c6755 Use docstrings for long help in clap derive 2022-12-06 01:28:15 -07:00
Thayne McCombs 39d80a59b6 Remove time from transitive dependencies of chrono
Because chrono was depending on an older version of time, and we don't
actually need it with recent versions of chrono.

Relates-To: #1188
Alernative-To: #1190
2022-12-03 01:28:17 -07:00
Thayne McCombs d441516c9d Use nu-ansi-term instead of ansi-term
Because ansi-term is no longer maintained.

Relates-To: #1188
2022-12-01 00:07:30 -07:00
David Peter 36e60223eb Use allow_hyphen_values = true for --and <pattern> 2022-11-21 21:08:41 +01:00
David Peter 0d9926de40 Move --and option up to other patter-related options 2022-11-21 21:06:48 +01:00
David Peter e147ba901b Minor fixes in help text 2022-11-21 21:06:48 +01:00
Kasper Gałkowski 7e26925933 Added the --and flag for matching multiple patterns 2022-11-21 21:06:48 +01:00
Thayne McCombs 67cf524287 Add --changed-after alias.
And make some small tweaks to the help text and man page.

Closes: #982
2022-11-20 23:21:53 -07:00
Thayne McCombs 64e642403e Use file_stem instead of file_name for command for completions
Fixes: #1177
2022-11-17 22:22:02 -07:00
Ptipiak 88bebb8aac Using faccess lib to detect executable files
* The detection of executable files was not exactly the same as
the original find
2022-11-15 10:31:44 +01:00
Bjoern Hiller 2fcfe7a5b7
Use just the file name of the program name
If passed a full path to the executable (like done in the Makefile) that
value is used in the generated completions. At least for fish this just
doesn't work.

This fixes #1172
2022-11-14 05:57:50 +01:00
Thayne McCombs 84bf65e023 Use unit type for negating optins with clap_derive
As now supported by https://github.com/clap-rs/clap/pull/4371  and https://github.com/clap-rs/clap/pull/4459
2022-11-11 02:09:41 -07:00
Thayne McCombs 2c3e40c9d9 Use new Shell::from_env method in clap_complete
Instead of having an fd specific implementation.
2022-11-11 02:09:41 -07:00
Thayne McCombs 0773b3067e Fix some warnings from clippy
I'm guessing these are new warnings from the Rust 1.65 release
2022-11-08 01:09:06 -07:00
Dominik Hassler 6ebc366146 anyhow is not only used for the completions feature 2022-11-07 17:11:00 +00:00
David Peter 99d1db8cb3
Merge pull request #1164 from tmccombs/owner-without-panic
Fix panic when using --owner
2022-11-03 09:08:09 +01:00
David Peter fbef976b92
Merge pull request #1159 from tmccombs/silence-large-variant
Silence warning about large enum variant
2022-11-03 08:54:52 +01:00
Thayne McCombs 55aae3a8c0 Silence warning about large enum variant
Because boxing the large variant is probably worse.
2022-11-03 00:56:56 -06:00
Thayne McCombs c159ea2042 Fix panic when using --owner
Unfortunately, clap_derive can't combine a value_parser of Option<T>
with an optional argument to get a merged Option<T> so we need to do the
check for the nop outside of the value parser.

Also adds some tests for --owner

Fixes: #1163
2022-11-02 23:26:02 -06:00
David Peter f15be89bff Fix --threads/-j option value parsing 2022-11-02 13:32:22 +01:00
David Peter 12165c73f8 Reorder command line options 2022-11-01 21:17:48 +01:00
David Peter 70c4865191 Set max. term width to make help texts easier to read 2022-11-01 21:14:16 +01:00
David Peter 7f5bc9884f Add simple 'about' text 2022-11-01 21:02:37 +01:00
David Peter ac35b11dc8 Change clap CLI binary name to 'fd' 2022-11-01 21:00:32 +01:00
David Peter b57ed11f65
Merge pull request #1137 from amesgen/batch-exit-code
Respect exit codes with `--exec-batch`
2022-11-01 20:42:28 +01:00
David Peter 831fe666fa Remove outdated TODO comment 2022-11-01 20:34:42 +01:00
David Peter 5771e74b95 Add newlines between options 2022-11-01 20:18:17 +01:00
David Peter 55029e889e Minor: add missing full stop 2022-11-01 20:13:32 +01:00
David Peter 3f72ef4cdd Remove outdated TODO comment 2022-11-01 20:07:09 +01:00
David Peter 169d22fde2 Merge remote-tracking branch 'origin/master' into clap-derive 2022-11-01 20:00:16 +01:00
Tavian Barnes 5278405263 walk: Use a bounded queue.
Fixes #918.
2022-11-01 19:48:39 +01:00
Tavian Barnes 5bb7a52704 walk: Switch back to crossbeam-channel
Fixes #933.  Fixes #1060.  Fixes #1113.
2022-11-01 19:48:39 +01:00
Tavian Barnes 93e5488420 walk: Simplify the code in scan() a bit 2022-11-01 15:36:48 +01:00
Thayne McCombs 36ee44a3f6 Make help output more like what it was before use clap_derive
In particular, we specifically use `long_help` instead of doc comments
because using  doc comments will always trim the "." off the end of the
first paragraph, and will include the short help as the first paragraph
of the full help.
2022-11-01 02:30:22 -06:00
Thayne McCombs 8500c3193d Merge remote-tracking branch 'upstream/master' into clap-derive 2022-11-01 01:12:41 -06:00
Tavian Barnes cd8ec44abf Address review comments 2022-10-31 22:23:30 +01:00
Tavian Barnes 17d849df6c Compute colors in parallel 2022-10-31 22:23:30 +01:00
Tavian Barnes b2c8888a50 dir_entry: Implement file_name() for broken symlinks 2022-10-31 22:23:30 +01:00
Tavian Barnes 7917c00887 dir_entry: Implement lscolors::Colorable 2022-10-31 22:23:30 +01:00
Thayne McCombs 3782278f02 Improve help output 2022-10-20 00:34:52 -06:00
Thayne McCombs a3622ba294 Remove TODO comment
In favor of tracking scoped threads in #1141
2022-10-19 23:43:45 -06:00
Thayne McCombs aec125637b Fix format 2022-10-14 23:14:03 -06:00
amesgen cb95f1dcd5
Respect exit codes with `--exec-batch` 2022-10-13 23:33:54 +02:00
Thayne McCombs b6f0088b68 Change thread option to take u32 instead of usize
To simplify the option parsing.
2022-10-12 00:33:49 -06:00
Thayne McCombs c2115884de Fix deprecations from clap 4.0 2022-10-11 22:27:57 -06:00
Thayne McCombs aca64c09f8 Actually test if exec or exec-batch is used
By the time we check if we should strip the cwd, we've already moved the
command out of the options, so store if we got that out earlier.
2022-10-09 01:25:03 -06:00
Thayne McCombs 86c33492a7 Fix name of powershell in guess_shell 2022-10-09 01:05:27 -06:00
Thayne McCombs c41d61eeda Merge remote-tracking branch 'upstream/master' into clap-derive 2022-10-09 01:00:48 -06:00
Thayne McCombs 5b9e302e9b Support powershell when guessing shell for completions 2022-10-09 00:02:28 -06:00
Thayne McCombs f4c34b81c7 Upgrade to clap 4.0 2022-10-08 23:51:45 -06:00
Thayne McCombs a50e417c67 Add action clap attribute to fixed_strings 2022-10-08 00:42:11 -06:00
Thayne McCombs ff7336b202 clap derive suggestions from epage 2022-10-08 00:42:11 -06:00
Thayne McCombs e6f4805bae Fix clippy warnings 2022-10-08 00:42:11 -06:00
Thayne McCombs 066ce41299 Fix case of color options to ls 2022-10-08 00:42:11 -06:00
Thayne McCombs b7f5f4ac7d Improve help output after switch to clap-derive
Make it more like it used to be.
2022-10-08 00:42:11 -06:00
Thayne McCombs 4e7b403c1f Use clap-derive for option parsing
This makes the definition of arguments to fd a little more ergonomic,
and makes it easier to insure the types for the arguments are consitent.
2022-10-08 00:41:33 -06:00
Tavian Barnes 4ffc34956f Make --strip-cwd-prefix apply to -x/-X
Fixes #898.
2022-10-03 21:35:39 +02:00
David Peter e3e6057434 Minor adaptation to help text 2022-09-27 21:00:29 +02:00
Scott Baker 12142008df Add a link back to Github to `--help` (but not `-h`) 2022-09-27 21:00:29 +02:00
Tavian Barnes 4419401b6c Enable --strip-cwd-prefix by default except with -0
Fixes #1046.
2022-09-27 20:56:24 +02:00
Tavian Barnes e46d402ed1 Enable jemallocator on 64-bit musl builds
Partial fix for #710 and #980.
2022-09-19 21:10:05 +02:00
David Peter 9ea882d7cc Fix clippy suggestions 2022-09-11 21:29:43 +02:00
David Peter 2569317ee8 Revert changes in help text, add /issues in manpage 2022-09-11 21:05:06 +02:00
Scott Baker cb91a5c848 Simplify some whitespace on lines 2022-09-11 21:05:06 +02:00
Scott Baker fcf8099587 Add Github URL to `--help` also 2022-09-11 21:05:06 +02:00
Marie Katrine Ekeberg d6b1d16bfc Use to_string_lossy to avoid relying on Debug-outputs 2022-09-11 20:58:50 +02:00
Marie Katrine Ekeberg c7370ca82c Simplistic "Command not found" error message 2022-09-11 20:58:50 +02:00
Tavian Barnes cbc6ddeefc Implement --type executable on Windows
Fixes #1051.
2022-09-11 20:46:19 +02:00
Sijmen cb6295d025 Move current_directory variable definition closer to usage 2022-08-10 20:01:21 +02:00
Sijmen fdcbb2f008 Allow working directory to be nonexistent if search path is given
Fixes #1072
2022-08-10 20:01:21 +02:00
David Peter 8b96a1e99c Update documentation of --batch-size feature 2022-05-28 22:59:46 +02:00
Tavian Barnes 40b368e761 exec: Execute batches before they get too long
Fixes #410.
2022-05-28 22:19:47 +02:00
David Peter 41affe18c4 Merge remote-tracking branch 'origin/master' into yyogo/master 2022-05-15 16:31:06 +02:00
David Peter f57206a3a1 Update help text and man page 2022-05-15 16:22:24 +02:00
Jackson Theel cbf3f11cf8 Make -u idempotent 2022-05-15 16:22:24 +02:00
Hang Qian 3f6ff2ca32 Match against reference instead of value 2022-04-02 20:56:38 +02:00
Jonathan Goren 60c14b1af2 make DirEntry Ord 2022-03-16 18:38:16 +02:00
Jonathan Goren 47e30d3d4a add actual path separator value to config 2022-03-16 18:13:05 +02:00
Thayne McCombs 38b84d08d7
Fix mistakes from resolving conflicts 2022-03-15 01:40:05 -06:00
Thayne McCombs 50c0fa812f
Merge branch 'master' into master 2022-03-15 01:20:35 -06:00
Thayne McCombs c577b0838b Error out if no args provided to --exec or --exec-batch
Accepting multiple occurances means we need to check this ourselves. See
https://github.com/clap-rs/clap/issues/3542.
2022-03-08 10:15:48 +01:00
Thayne McCombs 5a12a5e421 Use full names in command.rs 2022-03-08 10:15:48 +01:00
Thayne McCombs 9fb0c5d372 Group together output from multi exec commands
So that if multiple `--exec` options are given, and the commands are run
in parallel, the buffered output for related commands will be
consecutive.
2022-03-08 10:15:48 +01:00
Thayne McCombs f27332ee8d Fix clippy lints 2022-03-08 10:15:48 +01:00
Thayne McCombs 0aee9b0fd9 Support multiple `--exec` instances
and `--exec-batch`.

Fixes: #406
2022-03-08 10:15:48 +01:00
Thayne McCombs 6e5c8d9c20 Fix some clippy warnings 2022-03-04 08:30:41 +01:00
Thayne McCombs bbdb8b9d9e Upgrade to clap 3.1
And fix deprecations
2022-03-02 23:32:04 -07: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
Tavian Barnes e7f192f1c6 Revert "Switch from std::sync::mpsc to crossbeam-channel"
@sharkdp [noticed][1] a quite severe performance degredation due to this
change.  Switch back to std::sync::mpsc until we can fix the performance
regression.

This reverts commit a4bb734482.

[1]: https://github.com/sharkdp/fd/pull/895#issuecomment-1002099369
2021-12-28 12:11:32 -05:00
Yujia Qiao e5145ffb98 fix: disable jemalloc on risc-v target
`jemallocator` does not support risc-v and fails the compilation.
This fixes build for risc-v.
2021-12-28 17:38:28 +01:00
eatradish 639ed34791 Allow use to disable jemalloc
jemalloc will require special flags on devices where page size is not 4K. With default options fd will not work on a Mac Mini M1 where hardware only allow 16K paging size. This commit will allow the user to turn off jemalloc (using --no-default-features) under special circumstances where jemalloc is not usable.
2021-12-28 14:15:45 +01:00
Thayne McCombs b7e077320d
Fix logic for --no-ignore-parent (#908)
Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also
enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it
continues to respect .fdignore and .ignore in the parent directories.

Fixes: #907
Fixes: #901
2021-12-22 23:38:00 -07:00