sharkdp/fd
Systems
Internal building blocks of the fd binary. Each subsystem lives in its own module under src/.
| System | Source | Responsibility |
|---|---|---|
| CLI parsing | src/cli.rs, src/main.rs |
The Opts struct (clap derive), the custom Exec parser, smart-case detection, and the conversion from Opts to Config. |
| Walker | src/walk.rs |
Parallel directory traversal, batching, the buffer-then-stream receiver, and the Ctrl-C handler. |
| Filters | src/filter/, src/filetypes.rs, src/walk.rs |
Per-entry checks: file type, extension, size, modification time, owner, depth, exclude globs, ignore_contain. |
| Ignore rules | src/walk.rs (configured), ignore crate (implementation) |
.gitignore, .ignore, .fdignore, parent ignores, the global ignore, and --exclude overrides. |
| Command execution | src/exec/ |
--exec/--exec-batch machinery, CommandSet, CommandTemplate, CommandBuilder, and the per-thread job/batch receivers. |
| Format templates | src/fmt/ |
Shared placeholder engine for both --exec/--exec-batch arguments and --format output. |
| Output | src/output.rs, src/dir_entry.rs, src/hyperlink.rs |
Path formatting with colors, custom path separators, OSC 8 hyperlinks, trailing slashes for directories, null vs newline separators. |
How they connect
graph LR
cli[CLI parsing] -->|Opts → Config| walk[Walker]
walk -->|builds| ignore[Ignore rules]
walk -->|applies| filter[Filters]
walk -->|via channel| receive[Receiver]
receive -->|prints| output[Output]
receive -->|spawns| exec[Command execution]
exec -->|placeholders| fmt[Format templates]
output -->|optional| fmtWhere each subsystem reads Config
The Config struct in src/config.rs is the integration point. Every subsystem reads only the fields it needs:
- Walker reads
ignore_*,follow_links,one_file_system,max_depth,min_depth,prune,threads,quit_flagsemantics. - Filters read
file_types,extensions,size_constraints,time_constraints,owner_constraint,ignore_contain. - Receiver reads
quiet,max_results,max_buffer_time,command,show_filesystem_errors. - Output reads
ls_colors,hyperlink,format,path_separator,actual_path_separator,null_separator,strip_cwd_prefix. - Command execution reads
command,batch_size,path_separator,null_separator,threads.
This separation keeps each module testable in isolation: most subsystems own their own #[cfg(test)] mod tests block (see how-to-contribute/testing).
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.