Commit Graph

49 Commits

Author SHA1 Message Date
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 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
Matthias Reitinger 18709b1ede Remove shell with --exec 2017-11-15 23:18:36 +01:00
Antti Keränen 701b8f209b Relicense under MIT/Apache-2.0 2017-10-22 10:36:42 +02:00
Michael Aaron Murphy 6a01faf6e1 Escape exec Inputs 2017-10-21 00:29:46 +02:00
J.W 8d85debc12 Refactor path handling (fixes #113)
* Fix path check
* Fix full path matching
* Allow more simple driver names in Windows tests
* Factor out special is_dir() check for "." and ".."
2017-10-18 20:04:34 +02:00
Michael Aaron Murphy 1bc58b2fbb Group outputs from exec 2017-10-14 18:06:49 -04:00
Michael Aaron Murphy 718f723d31 Enable absolute paths w/ exec 2017-10-14 16:42:47 -04:00
Michael Aaron Murphy 884bd41cae Apply cargo fmt 2017-10-14 14:04:04 -04:00
Michael Aaron Murphy fb1cd3a322 Fix for older builds
Rust 1.19 will be a requirement, however.
2017-10-14 13:38:54 -04:00
Michael Aaron Murphy 4a5a5faf4d Implement --exec feature
Closes #84
2017-10-14 12:24:17 -04:00