Skip to content
Myr

Re-structure

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

authored by sharkdp · committed by sharkdp · parent b4a252a · Browse files · 1 file+16 added−13 removed
This commit

State

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

Diff stats

1 file+16 added−13 removed

  • other:+16 added−13 removed

1 file+16 added−13 removed

modified:src/main.rs+16 added-13 removed
25 unmodified lines
26 max_depth: usize27}2829/// Print a search result to the console.30fn print_entry(entry: &DirEntry, path_str: &str, config: &FdOptions) {30fn print_entry(entry: &DirEntry, path_rel: &Path, config: &FdOptions) {31 let path_str = match path_rel.to_str() {32 Some(p) => p,33 None => return34 };3536 if config.colored {37 let style = match entry {38 e if e.path_is_symbolic_link() => Colour::Purple,39 e if e.path().is_dir() => Colour::Cyan,
29 unmodified lines
69 Ok(p) => p,70 Err(_) => continue71 };7268 if let Some(path_str) = path_rel.to_str() {69 let res =70 if config.search_full_path {71 pattern.find(path_str)72 } else {73 if !path_rel.is_file() { continue }73 let search_str =74 if config.search_full_path {75 path_rel.to_str()76 } else {77 if !path_rel.is_file() { continue }7875 path_rel.file_name()76 .and_then(OsStr::to_str)77 .and_then(|s| pattern.find(s))78 };79 path_rel.file_name()80 .and_then(OsStr::to_str)81 };8280 res.map(|_| print_entry(&entry, path_str, &config));81 }83 search_str.and_then(|s| pattern.find(s))84 .map(|_| print_entry(&entry, path_rel, &config));85 }86}8788/// Print error message to stderr and exit with status `1`.
65 unmodified lines