Skip to content
Myr

Update documentation for --exec syntax change

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

authored by Matthias Reitinger · committed by David Peter · parent 0f82fe7 · Browse files · 3 files+25 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

3 files+25 added−19 removed

  • other:+25 added−19 removed

3 files+25 added−19 removed

modified:doc/fd.1+7 added-7 removed
99 unmodified lines
100.TP101.BI "\-j, \-\-threads " num102Number of threads to use for searching (default: number of available CPUs).103.TP104.BI "\-x, \-\-exec " command104.BI "\-x, \-\-exec " command [args...] ;105Execute106.I command107on each of the discovered path with the following tokens substituted:107for each search result. The following placeholders are substituted by a path derived from the current search result:108.RS109.IP {}110path111.IP {.}112path without extension111.IP {/}114basename of path112basename113.IP {//}116parent of path114parent directory115.IP {.}116path without file extension117.IP {/.}118basename of path without extension118basename without file extension119.RE120.SH ENVIRONMENT121.TP122.B LS_COLORS
14 unmodified lines
modified:src/app.rs+12 added-9 removed
84 unmodified lines
85 arg("exec")86 .long("exec")87 .short("x")88 .multiple(true)89 .min_values(1)90 .allow_hyphen_values(true)91 .value_terminator(";")92 .value_name("cmd"),93 )
79 unmodified lines
173 doc!(h, "extension"174 , "Filter by file extension"175 , "(Additionally) filter search results by their file extension.");176 doc!(h, "exec"176 , "Execute the given command for each search result"177 , "Execute the given command for each search result.\n\178 The following are valid tokens that can be used within the expression for generating \179 commands:\n \180 '{}': places the input in the location of this token\n \181 '{.}': removes the extension from the input\n \182 '{/}': places the basename of the input\n \183 '{//}': places the parent of the input\n \184 '{/.}': places the basename of the input, without the extension");177 , "Execute a command for each search result"178 , "Execute a command for each search result.\n\179 All arguments following -exec are are taken to be arguments to the command until the \180 argument ';' is encountered.\n\181 Each occurrence of the following placeholders is substituted by a path derived from the \182 current search result before the command is executed:\n \183 '{}': path\n \184 '{/}': basename\n \185 '{//}': parent directory\n \186 '{.}': path without file extension\n \187 '{/.}': basename without file extension");188 doc!(h, "exclude"189 , "Exclude entries that match the given glob pattern."190 , "Exclude files/directories that match the given glob pattern. This overrides any \191 other ignore logic. Multiple exclude patterns can be specified.");
26 unmodified lines
modified:README.md+6 added-3 removed
108 unmodified lines
109- `{//}`: Uses the parent of the discovered path (`documents/images`).110- `{/.}`: Uses the basename, with the extension removed (`party`).111112``` bash113# Convert all jpg files to png files114fd -e jpg -x 'convert {} {.}.png'113# Convert all jpg files to png files:114fd -e jpg -x convert {} {.}.png115116# Unpack all zip files (if no placeholder is given, the path is appended):117fd -e zip -x unzip118119# Convert all flac files into opus files:120fd -e flac -x 'ffmpeg -i {} -c:a libopus {.}.opus'120fd -e flac -x ffmpeg -i {} -c:a libopus {.}.opus121122# Count the number of lines in Rust files (the command template can be terminated with ';'):123fd -x wc -l \; -e rs124```125126## Install127With Rust's package manager [cargo](https://github.com/rust-lang/cargo), you can install *fd* via:
174 unmodified lines