Skip to content
Myr

Minor style changes

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

authored by sharkdp · committed by sharkdp · parent 2a3dd5b · Browse files · 3 files+21 added−20 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+21 added−20 removed

  • other:+21 added−20 removed

3 files+21 added−20 removed

modified:src/main.rs+19 added-18 removed
38 unmodified lines
39 /// As a relative path40 Relative41}4243/// The type of file to search for.44#[derive(Copy, Clone)]45enum FileType {46 Any,47 RegularFile,48 Directory,49 SymLink50}5152/// Configuration options for *fd*.53struct FdOptions {54 /// Determines whether the regex search is case-sensitive or case-insensitive.55 case_sensitive: bool,
34 unmodified lines
90 /// `None` if the output should not be colorized. Otherwise, a `LsColors` instance that defines91 /// how to style different filetypes.92 ls_colors: Option<LsColors>,9394 /// The type of file to search for. All files other than the specified type will be ignored.95 file_type: FileType,96}9788/// The type of file to search for. All files other than the specified type will be ignored.89#[derive(Copy, Clone)]90enum FileType {91 Any,92 RegularFile,93 Directory,94 SymLink,95}9698/// The receiver thread can either be buffering results or directly streaming to the console.99enum ReceiverMode {100 /// Receiver is still buffering in order to sort the results, if the search finishes fast101 /// enough.
187 unmodified lines
289 // Filter out unwanted file types.290 match config.file_type {291 FileType::Any => (),292 FileType::RegularFile => if entry.file_type().map_or(false, |ft| !ft.is_file()) {292 return ignore::WalkState::Continue;293 return ignore::WalkState::Continue;294 },295 FileType::Directory => if entry.file_type().map_or(false, |ft| !ft.is_dir()) {295 return ignore::WalkState::Continue;296 return ignore::WalkState::Continue;297 },298 FileType::SymLink => if entry.file_type().map_or(false, |ft| !ft.is_symlink()) {298 return ignore::WalkState::Continue;299 return ignore::WalkState::Continue;300 },301 }302303 let path_rel_buf = match fshelper::path_relative_from(entry.path(), &*base) {
176 unmodified lines
480 } else {481 PathDisplay::Relative482 },483 ls_colors: ls_colors,483 file_type: match matches.value_of("file-type") {484 Some("f") | Some("file") => FileType::RegularFile,485 Some("d") | Some("directory") => FileType::Directory,486 Some("s") | Some("symlink") => FileType::SymLink,487 _ => FileType::Any,488 },484 file_type: match matches.value_of("file-type") {485 Some("f") | Some("file") => FileType::RegularFile,486 Some("d") | Some("directory") => FileType::Directory,487 Some("s") | Some("symlink") => FileType::SymLink,488 _ => FileType::Any,489 },490 };491492 let root = Path::new(ROOT_DIR);493 let base = match config.path_display {
11 unmodified lines
modified:Cargo.lock+1 added-1 removed
1[root]2name = "fd-find"3version = "3.0.0"3version = "3.1.0"4dependencies = [5 "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",6 "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",7 "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
270 unmodified lines
modified:Cargo.toml+1 added-1 removed