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
Provenance
- Commit
5f4a120- Tree
6cf1ed9- Author
Matthias Reitinger <reima@edenprime.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
0f82fe7
3 files changed+25 added−19 removed
modified:doc/fd.1+7 added-7 removed
99 unmodified lines100 .TP101 .BI "\-j, \-\-threads " num102 Number of threads to use for searching (default: number of available CPUs).103 .TP104-.BI "\-x, \-\-exec " command104+.BI "\-x, \-\-exec " command [args...] ;105 Execute106 .I command107-on each of the discovered path with the following tokens substituted:107+for each search result. The following placeholders are substituted by a path derived from the current search result:108 .RS109 .IP {}110 path111-.IP {.}112-path without extension111 .IP {/}114-basename of path112+basename113 .IP {//}116-parent of path114+parent directory115+.IP {.}116+path without file extension117 .IP {/.}118-basename of path without extension118+basename without file extension119 .RE120 .SH ENVIRONMENT121 .TP122 .B LS_COLORS14 unmodified linesmodified:src/app.rs+12 added-9 removed
84 unmodified lines85 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 lines173 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 linesmodified:README.md+6 added-3 removed
108 unmodified lines109 - `{//}`: Uses the parent of the discovered path (`documents/images`).110 - `{/.}`: Uses the basename, with the extension removed (`party`).111 112 ``` bash113-# Convert all jpg files to png files114-fd -e jpg -x 'convert {} {.}.png'113+# Convert all jpg files to png files:114+fd -e jpg -x convert {} {.}.png115 116 # Unpack all zip files (if no placeholder is given, the path is appended):117 fd -e zip -x unzip118 119 # Convert all flac files into opus files:120-fd -e flac -x 'ffmpeg -i {} -c:a libopus {.}.opus'120+fd -e flac -x ffmpeg -i {} -c:a libopus {.}.opus121+122+# Count the number of lines in Rust files (the command template can be terminated with ';'):123+fd -x wc -l \; -e rs124 ```125 126 ## Install127 With Rust's package manager [cargo](https://github.com/rust-lang/cargo), you can install *fd* via:174 unmodified lines