Repository: sharkdp/fd
File: src/main.rs (Rust)

Code before:
    // if the pattern has an uppercase character (smart case).
    let case_sensitive = matches.is_present("case-sensitive") ||
                         pattern.chars().any(char::is_uppercase);

    let colored_output = match matches.value_of("color") {
        Some("always") => true,
        Some("never") => false,
        _ => atty::is(Stream::Stdout)
    };

    let ls_colors =
        if colored_output {
            Some(
                env::var("LS_COLORS")
                    .ok()
                    .map(|val| LsColors::from_string(&val))
                    .unwrap_or_default()
            )
        } else {
            None
        };

    let config = FdOptions {
        case_sensitive:    case_sensitive,
        search_full_path:  matches.is_present("full-path"),
        ignore_hidden:     !(matches.is_present("hidden") || matches.occurrences_of("rg-alias-hidden-ignore") == 2),
        read_ignore:       !(matches.is_present("no-ignore") || matches.is_present("rg-alias-hidden-ignore")),
        follow_links:      matches.is_present("follow"),
        null_separator:    matches.is_present("null_separator"),
        max_depth:         matches.value_of("depth")
                                   .and_then(|n| usize::from_str_radix(n, 10).ok()),
        threads:           std::cmp::max(
                             matches.value_of("threads")
                                    .and_then(|n| usize::from_str_radix(n, 10).ok())
                                    .unwrap_or_else(num_cpus::get),
                             1
                           ),
        max_buffer_time:   matches.value_of("max-buffer-time")
                                  .and_then(|n| u64::from_str_radix(n, 10).ok())
                                  .map(time::Duration::from_millis),
        path_display:      if matches.is_present("absolute-path") || root_dir_is_absolute {
                               PathDisplay::Absolute
                           } else {
                               PathDisplay::Relative
                           },
        ls_colors:         ls_colors,
        file_type:         match matches.value_of("file-type") {
                               Some("f") | Some("file") => FileType::RegularFile,
                               Some("d") | Some("directory") => FileType::Directory,
                               Some("l") | Some("symlink") => FileType::SymLink,
                               _  => FileType::Any,

Review comment (suggestion):
We could potentially set this to `.. >= 2`, right?

`ripgrep` has up to three occurences of `-u`, so someone might try to be on the safe side by putting `-uuu`. Just a thought.. I think it wouldn't hurt.

Code after:
    // if the pattern has an uppercase character (smart case).
    let case_sensitive = matches.is_present("case-sensitive") ||
                         pattern.chars().any(char::is_uppercase);

    let colored_output = match matches.value_of("color") {
        Some("always") => true,
        Some("never") => false,
        _ => atty::is(Stream::Stdout)
    };

    let ls_colors =
        if colored_output {
            Some(
                env::var("LS_COLORS")
                    .ok()
                    .map(|val| LsColors::from_string(&val))
                    .unwrap_or_default()
            )
        } else {
            None
        };

    let config = FdOptions {
        case_sensitive:    case_sensitive,
        search_full_path:  matches.is_present("full-path"),
        ignore_hidden:     !(matches.is_present("hidden") || matches.occurrences_of("rg-alias-hidden-ignore") >= 2),
        read_ignore:       !(matches.is_present("no-ignore") || matches.is_present("rg-alias-hidden-ignore")),
        follow_links:      matches.is_present("follow"),
        null_separator:    matches.is_present("null_separator"),
        max_depth:         matches.value_of("depth")
                                   .and_then(|n| usize::from_str_radix(n, 10).ok()),
        threads:           std::cmp::max(
                             matches.value_of("threads")
                                    .and_then(|n| usize::from_str_radix(n, 10).ok())
                                    .unwrap_or_else(num_cpus::get),
                             1
                           ),
        max_buffer_time:   matches.value_of("max-buffer-time")
                                  .and_then(|n| u64::from_str_radix(n, 10).ok())
                                  .map(time::Duration::from_millis),
        path_display:      if matches.is_present("absolute-path") || root_dir_is_absolute {
                               PathDisplay::Absolute
                           } else {
                               PathDisplay::Relative
                           },
        ls_colors:         ls_colors,
        file_type:         match matches.value_of("file-type") {
                               Some("f") | Some("file") => FileType::RegularFile,
                               Some("d") | Some("directory") => FileType::Directory,
                               Some("l") | Some("symlink") => FileType::SymLink,
                               _  => FileType::Any,