Commit graph

277 commits

Author SHA1 Message Date
Thayne McCombs
1d57b3a064 Simplify parsing number of threads. 2023-10-25 23:56:59 -06:00
Christian Göttsche
36bc84041b Support character and block device file types 2023-10-21 13:56:33 +02:00
Thayne McCombs
740edeb73f Replace atty with std
std now has a function for testing if stdout is a tty
2023-06-08 00:10:53 -06:00
Nathan Houghton
42244e5f32 Don't use jemalloc on OpenBSD (jemalloc fails to compile) 2023-04-14 21:24:19 +02: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
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
Kasper Gałkowski
7e26925933 Added the --and flag for matching multiple patterns 2022-11-21 21:06:48 +01: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
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
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
831fe666fa Remove outdated TODO comment 2022-11-01 20:34:42 +01: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
c41d61eeda Merge remote-tracking branch 'upstream/master' into clap-derive 2022-10-09 01:00:48 -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
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
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
41affe18c4 Merge remote-tracking branch 'origin/master' into yyogo/master 2022-05-15 16:31:06 +02:00
Jackson Theel
cbf3f11cf8 Make -u idempotent 2022-05-15 16:22:24 +02:00
Jonathan Goren
47e30d3d4a add actual path separator value to config 2022-03-16 18:13:05 +02: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
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
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
Jonathan Goren
3dc61b5f28 rename module entry -> dir_entry 2021-12-11 15:43:52 +02:00
Jonathan Goren
813a802b2c send DirEntries to output instead of just path 2021-12-11 15:42:07 +02:00
Alexander Sieg
5fbfdfadb8 fix: disable jemalloc on FreeBSD
As jemalloc is the default system allocator on FreeBSD and the
jemalloc-sys crate failes to compile on FreeBSD, this fixes the build on
FreeBSD.
2021-11-28 17:42:15 +01:00
David Peter
92bd7850d0 Merge remote-tracking branch 'origin/master' into no-strip/760 2021-11-26 18:19:28 +01:00
David Peter
4d7e34ad59 Rename option to strip_cwd_prefix, rename CLI option 2021-11-26 17:46:04 +01:00
Tavian Barnes
2b1bf471b1 Add an exit() method to ExitCode 2021-11-15 07:53:57 +01:00
Devon Hollowood
17dd2a6dfe
Implement --batch-size (#866) 2021-10-22 00:05:13 -06:00
Jonah Caplan
bf9e6fd36e add -P option to strip prefix to tty 2021-10-17 00:29:51 -04:00
Jonah Caplan
a41021b0d2 use interactive_terminal 2021-10-16 14:34:58 -04:00
Jonah Caplan
82f04755bf hopefully fix build error on windows 2021-10-16 14:21:11 -04:00
Jonah Caplan
c42bf4b904 don't strip paths for -X/x, and for tty output 2021-10-16 14:15:37 -04:00
Jonah Caplan
fbc836b553 Revert -X stuff
This reverts commit 91860bf682.
2021-10-16 14:03:23 -04:00
Jonah Caplan
91860bf682 fmt 2021-10-16 00:02:37 -04:00
Jonah Caplan
953f586f26 replace -N option with specifying '.' path 2021-10-15 23:57:03 -04:00
Jonah Caplan
6b92c5db90 add -N/--no-strip option to show "./" prefix on relative paths 2021-10-15 23:56:36 -04:00
Niklas Mohrin
02e9850112 Refactor: Rename Options to Config 2021-10-12 18:49:07 +02:00
Niklas Mohrin
b8c575cc8f Refactor: extract some methods out of run and reorder main.rs
Now, the top method is `main`, then comes `run`, then the methods used
in `run` follow. Generally, a method is always declared somewhere after
its first use. This way, you can read the file from top to bottom with
a decreasing level of abstraction (you start with very high-level
processes like setting the current dir and logic for which ls command to
use only comes furher down).
2021-10-12 18:49:07 +02:00