Commit Graph

59 Commits

Author SHA1 Message Date
Thayne McCombs
d44badc190 Implement option for printing custom formats 2024-05-07 22:52:49 -06: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
91e3c3cba5 Replace once_cell with stdlib
LazyLock isn't standardized yet, but OnceLock is good enough for what we
need.
2023-06-08 00:05: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
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
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
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
amesgen
cb95f1dcd5
Respect exit codes with --exec-batch 2022-10-13 23:33:54 +02:00
Thayne McCombs
c41d61eeda Merge remote-tracking branch 'upstream/master' into clap-derive 2022-10-09 01:00:48 -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
David Peter
9ea882d7cc Fix clippy suggestions 2022-09-11 21:29:43 +02:00
Tavian Barnes
40b368e761 exec: Execute batches before they get too long
Fixes #410.
2022-05-28 22:19:47 +02: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
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
David Peter
92bd7850d0 Merge remote-tracking branch 'origin/master' into no-strip/760 2021-11-26 18:19:28 +01:00
David Peter
47421a49b8 Remove strip-prefix placeholders 2021-11-26 17:58:18 +01:00
Shun Sakai
0484486f3f Remove lazy_static from dependencies 2021-11-25 20:06:43 +01:00
Jonah Caplan
bf9e6fd36e add -P option to strip prefix to tty 2021-10-17 00:29:51 -04:00
Jonah Caplan
46db1c4ef3 add {-} format for exec 2021-10-16 23:52:04 -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
b6f8bc8ff8 also handle -X and -x with no_strip 2021-10-15 23:57:03 -04:00
a1346054
5b4869a940 fix spelling 2021-08-14 16:21:02 +02:00
Thayne McCombs
e4730603d0 Address feedback for removing buffering when running on a single thread 2021-08-11 09:38:55 +02:00
Max Triano
394e967b5f No buffering cmd output when running on 1 thread 2021-08-11 09:38:55 +02:00
David Peter
2a2126c40a Fix clippy warnings 2021-07-27 09:05:23 +02:00
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
Alexandru Macovei
4f4330167a Fix some clippy lints, and format 2020-05-01 14:08:53 +02:00
sharkdp
7e3c69c096 Reimplement dirname, basename, remove_extension for OsStr 2020-04-04 18:46:08 +02:00
sharkdp
439548c25a panic => unreachable 2020-04-04 18:46:08 +02:00
sharkdp
ed45d1c5af Remove duplicate 'strip prefix' function 2020-04-04 18:46:08 +02:00
sharkdp
f9372b55d5 Remove irrelevant TODO 2020-04-03 22:36:32 +02:00
sharkdp
bce95274e3 Proper error handling in main.rs 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
fusillicode
fa7d49282b Restun exit code for generate_and_execute? 2020-02-22 12:32:35 +01:00
MarcoIeni
320d7fca0a Sort search results when using -X option 2020-01-02 21:52:26 +01:00
sharkdp
a0505bd4df Expose exit status from --exec-batch <cmd>
closes #333
2019-09-13 23:05:35 +02: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
kimsnj
32ec7afc3a Add test with multiple tokens in an argument 2018-11-10 10:29:35 +01:00
teresy
34b8c0df73 refactor: use shorthand fields 2018-11-08 11:48:12 +01:00
Josh Leeb-du Toit
adc467b2b2 Add exec tests and cfg(test) compiler guards
Some tests throughout the codebase were just functions marked with the
`#[test]` macro. It is convention to have these test functions in a
`test` module with a compiler guard `cfg(test)`. This PR updates the
tests that aren't already setup like this to be in the `test` module.

Additionally, this PR also adds tests to the `exec` module to check the
remaining `Token` enum variations.
2018-10-03 13:04:22 +02:00
sharkdp
6a9f16e159 Run latest version of rustfmt 2018-04-13 23:13:22 +02:00
sharkdp
a5f5ad6254 Re-enable code style check 2018-01-01 16:00:32 +01:00
Matthias Reitinger
0f82fe7ec0 Rename TokenizedCommand to CommandTemplate 2017-11-15 23:18:36 +01:00
Matthias Reitinger
c18caaa6f6 Remove CommandTicket to avoid Vec allocation 2017-11-15 23:18:36 +01:00