Skip to content
Myr

docs: clarify that -e/--extension matches all entry types

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

Short help stays minimal; long help and man page explain that extension filtering applies to directories as well unless --type restricts results. Addresses maintainer feedback on #1922. Fixes #1693

authored by wuyangfan · committed by wuyangfan · parent 7f1b147 · Browse files · 3 files+13 added−10 removed
This commit

State

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

Trailers

  • Co-authored-by: Cursor <cursoragent@cursor.com>

Diff stats

3 files+13 added−10 removed

  • other:+13 added−10 removed

3 files+13 added−10 removed

modified:doc/fd.1+6 added-4 removed
134 unmodified lines
135By default, fd does not descend into symlinked directories. Using this flag, symbolic links are136also traversed. The flag can be overridden with '--no-follow'.137.TP138.B \-p, \-\-full\-path139By default, the search pattern is only matched against the filename (or directory name). Using139By default, the search pattern is only matched against the last path component (file or directory name). Using140this flag, the141.I pattern142is matched against the full path.142is matched against the absolute path.143.TP144.B \-0, \-\-print0145Separate search results by the null character (instead of newlines). Useful for piping results to146.IR xargs .
102 unmodified lines
249 fd -te -td250.RE251.TP252.BI "\-e, \-\-extension " ext253Filter search results by file extension253Filter search results by extension254.IR ext .255By default, this applies to all entry types. Use \fB\-\-type\fR to restrict256the search to specific types.255This option can be used repeatedly to allow for multiple possible file extensions.257This option can be used repeatedly to allow for multiple possible extensions.258259If you want to search for files without extension, you can use the regex '^[^.]+$'260as a normal search pattern.261.TP
319 unmodified lines
modified:src/cli.rs+6 added-5 removed
237 unmodified lines
238 /// Overrides --follow239 #[arg(long, overrides_with = "follow", hide = true, action = ArgAction::SetTrue)]240 no_follow: (),241242 /// By default, the search pattern is only matched against the filename (or directory name). Using this flag, the pattern is matched against the full (absolute) path. Example:242 /// By default, the search pattern is only matched against the last path component (file or directory name). Using this flag, the pattern is matched against the absolute path. Example:243 /// fd --glob -p '**/.git/config'244 #[arg(245 long,246 short = 'p',247 help = "Search full abs. path (default: filename only)",247 help = "Search absolute path (default: last path component only)",248 long_help,249 verbatim_doc_comment250 )]251 pub full_path: bool,
111 unmodified lines
363 long_help364 )]365 pub filetype: Option<Vec<FileType>>,366367 /// (Additionally) filter search results by their file extension. Multiple368 /// allowable file extensions can be specified.367 /// Filter results by extension. By default, this matches all entry types368 /// (including directories whose names end with the extension). Use `--type`369 /// to restrict the search to specific types. Multiple extensions can be specified.370 ///371 /// If you want to search for files without extension,372 /// you can use the regex '^[^.]+$' as a normal search pattern.373 #[arg(374 long = "extension",375 short = 'e',376 value_name = "ext",376 help = "Filter by file extension",377 help = "Filter by extension",378 long_help379 )]380 pub extensions: Option<Vec<String>>,381
573 unmodified lines
modified:README.md+1 added-1 removed
326 unmodified lines
327 -E, --exclude <glob> Exclude entries that match the given glob pattern328 -t, --type <filetype> Filter by type: file (f), directory (d/dir), symlink (l),329 executable (x), empty (e), socket (s), pipe (p), char-device330 (c), block-device (b)331 -e, --extension <ext> Filter by file extension331 -e, --extension <ext> Filter by extension332 -S, --size <size> Limit results based on the size of files333 --changed-within <date|dur> Filter by file modification time (newer than)334 --changed-before <date|dur> Filter by file modification time (older than)335 -o, --owner <user:group> Filter by owning user and/or group
455 unmodified lines