Skip to content
Myr

Updates for the parallel command execution part

Before adoption: this commit came in with the history the project adopted, so no landing records it.

[skip ci]

authored by sharkdp · committed by David Peter · parent 5863a5e · Browse files · 1 file+17 added−19 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+17 added−19 removed

  • other:+17 added−19 removed

1 file+17 added−19 removed

modified:README.md+17 added-19 removed
95 unmodified lines
96complete (and more colorful) variants, see97[here](https://github.com/seebi/dircolors-solarized) or98[here](https://github.com/trapd00r/LS_COLORS).99100## Parallel Command Execution101If the `--exec` flag is specified alongside a command template, a job pool will be created for102generating and executing commands in parallel with each discovered path as the inputs. The syntax103for generating commands is similar to that of GNU Parallel:100## Parallel command execution101If the `-x`/`--exec` option is specified alongside a command template, a job pool will be created102for executing commands in parallel for each discovered path as the input. The syntax for generating103commands is similar to that of GNU Parallel:104105- **{}**: A placeholder token that will be replaced with the discovered path.106- **{.}**: Removes the extension from the path.107- **{/}**: Uses the basename of the discovered path.108- **{//}**: Uses the parent of the discovered path.109- **{/.}**: Uses the basename, with the extension removed.105- `{}`: A placeholder token that will be replaced with the path of the search result106 (`documents/images/party.jpg`).107- `{.}`: Like `{}`, but without the file extension (`documents/images/party`).108- `{/}`: A placeholder that will be replaced by the basename of the search result (`party.jpg`).109- `{//}`: Uses the parent of the discovered path (`documents/images`).110- `{/.}`: Uses the basename, with the extension removed (`party`).111111```sh112# Demonstration of parallel job execution113fd -e flac --exec 'sleep 1; echo $\{SHELL}: {}'112``` bash113# Convert all jpg files to png files114fd -e jpg -x 'convert "{}" "{.}.png"'115115# This also works, because `SHELL` is not a valid token116fd -e flac --exec 'sleep 1; echo ${SHELL}: {}'116# Unpack all zip files (if no placeholder is given, the path is appended):117fd -e zip -x unzip118118# The token is optional -- it gets added at the end by default.119fd -e flac --exec 'echo'120121# Real world example of converting flac files into opus files.122fd -e flac --type f --exec 'ffmpeg -i "{}" -c:a libopus "{.}.opus"'119# Convert all flac files into opus files:120fd -e flac -x 'ffmpeg -i "{}" -c:a libopus "{.}.opus"'121```122123## Install124With Rust's package manager [cargo](https://github.com/rust-lang/cargo), you can install *fd* via:
167 unmodified lines