How sharkdp/fd works
fd is a command-line filesystem search tool. The principal workflow is: a user supplies a pattern and search options; the program builds configuration and match expressions; parallel traversal discovers and filters entries; results are formatted and printed or dispatched to external commands. The graph also preserves documented regex/glob search, ignore and file-type controls, and command execution. Relationships use the README or source-index references and excerpts; some internal calls are not visible in the sampled source, so uncertain links are omitted.
Main entry points: main.rs Program entry · walk.rs Parallel traversal · output.rs Result rendering · mod.rs Command execution
Components 24
CLI setup
- Program entry
src/main.rs - Option parsing
src/cli.rs - Pattern building
src/regex_helper.rs - Search config
src/config.rs
Search engine
- Parallel traversal
src/walk.rs - Filesystem helpers
src/filesystem.rs
Entry details
- Directory entries
src/dir_entry.rs - File type rules
src/filetypes.rs - Metadata filters
src/filter - Owner filter
src/filter/owner.rs - Size filter
src/filter/size.rs - Time filter
src/filter/time.rs
Results and actions
- Result rendering
src/output.rs - Output formatting
src/fmt/mod.rs - Format input
src/fmt/input.rs - Terminal safety
src/sanitize.rs - Path hyperlinks
src/hyperlink.rs - Command execution
src/exec/mod.rs - Command templates
src/exec/command.rs - Execution jobs
src/exec/job.rs - Exit status
src/exit_codes.rs
Other components
- User
- Filesystem
- External commands
Connections 27
- User → Program entry: runs search
README.md - Program entry → Option parsing: parses options
src/main.rs - Program entry → Pattern building: builds patterns
src/main.rs - Program entry → Search config: constructs config
src/main.rs - Program entry → Parallel traversal: starts scan
src/main.rs - Program entry → Exit status: exits with
src/main.rs - Parallel traversal → Filesystem helpers: checks paths
src/walk.rs - Filesystem helpers → Filesystem: reads entries
- Parallel traversal → Directory entries: produces entries
src/walk.rs - Directory entries → Filesystem helpers: reads metadata
src/dir_entry.rs - Parallel traversal → Result rendering: prints matches
src/walk.rs - Parallel traversal → Command execution: dispatches results
src/walk.rs - Search config → Metadata filters: configures filters
src/config.rs - Metadata filters → Owner filter: exports filter
src/filter/mod.rs - Metadata filters → Size filter: exports filter
src/filter/mod.rs - Metadata filters → Time filter: exports filter
src/filter/mod.rs - Search config → File type rules: configures types
src/config.rs - Result rendering → Output formatting: formats paths
src/output.rs - Output formatting → Format input: uses input
src/fmt/mod.rs - Result rendering → Terminal safety: sanitizes text
src/output.rs - Result rendering → Path hyperlinks: creates links
src/output.rs - Result rendering → Directory entries: renders entries
src/output.rs - Command execution → Command templates: builds commands
src/exec/mod.rs - Command execution → Execution jobs: runs jobs
src/exec/mod.rs - Command execution → External commands: launches processes
- Command execution → Exit status: tracks status
src/exec/mod.rs - Parallel traversal → Exit status: returns status
src/walk.rs