Skip to content
Myr

Only parse dir_colors if output is colored, closes #21

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

authored by sharkdp · committed by sharkdp · parent bb63a4c · Browse files · 1 file+12 added−5 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+12 added−5 removed

  • other:+12 added−5 removed

1 file+12 added−5 removed

modified:src/main.rs+12 added-5 removed
231 unmodified lines
232 Err(_) => error("Could not get current directory!")233 };234 let current_dir = current_dir_buf.as_path();235236 let ext_styles = env::home_dir()237 .map(|h| h.join(".dir_colors"))238 .and_then(|path| parse_dircolors(&path).ok());236 let colored_output = !matches.opt_present("no-color") &&237 stdout_isatty();238239 let ext_styles =240 if colored_output {241 env::home_dir()242 .map(|h| h.join(".dir_colors"))243 .and_then(|path| parse_dircolors(&path).ok())244 } else {245 None246 };247248 let config = FdOptions {249 // The search will be case-sensitive if the command line flag is set or250 // if the pattern has an uppercase character (smart case).251 case_sensitive: matches.opt_present("sensitive") ||252 pattern.chars().any(char::is_uppercase),253 search_full_path: !matches.opt_present("filename"),254 search_hidden: matches.opt_present("hidden"),247 colored: !matches.opt_present("no-color") &&248 stdout_isatty(),255 colored: colored_output,256 follow_links: matches.opt_present("follow"),257 max_depth:258 matches.opt_str("max-depth")259 .and_then(|ds| usize::from_str_radix(&ds, 10).ok())
11 unmodified lines