Skip to content
Myr

Updates and preparations for v5.0

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

authored by sharkdp · committed by David Peter · parent 15a3ca0 · Browse files · 10 files+26 added−21 removed
This commit

State

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

Diff stats

10 files+26 added−21 removed

  • other:+26 added−21 removed

10 files+26 added−21 removed

modified:src/exec/job.rs+1 added-1 removed
36 unmodified lines
37 // Drop the lock so that other threads can read from the the receiver.38 drop(lock);39 // Generate a command to store within the buffer, and execute the command.40 // Note that the `then_execute()` method will clear the buffer for us.41 cmd.generate(buffer, &value, out_perm.clone())41 cmd.generate(buffer, &value, Arc::clone(&out_perm))42 .then_execute();43 }44}
modified:src/exec/ticket.rs+1 added-1 removed
15 unmodified lines
16 /// preferred shell of choice for execution. Windows will simply use `cmd`.17 static ref COMMAND: (String, &'static str) = if cfg!(target_os = "windows") {18 ("cmd".into(), "/C")19 } else {20 (env::var("SHELL").unwrap_or("/bin/sh".into()), "-c")20 (env::var("SHELL").unwrap_or_else(|_| "/bin/sh".into()), "-c")21 };22}2324/// A state that offers access to executing a generated command.
117 unmodified lines
modified:src/lscolors/mod.rs+1 added-1 removed
15 unmodified lines
1617/// Maps filenames to ANSI colors / styles.18pub type FilenameStyles = HashMap<String, Style>;1920const LS_CODES: &'static [&'static str] = &[20const LS_CODES: &[&str] = &[21 "no",22 "no",23 "fi",24 "rs",
242 unmodified lines
modified:src/app.rs+9 added-4 removed
101 unmodified lines
102 .long("max-buffer-time")103 .takes_value(true)104 .hidden(true),105 )106 .arg(arg("exec").long("exec").short("x").takes_value(true))106 .arg(107 arg("exec")108 .long("exec")109 .short("x")110 .takes_value(true)111 .value_name("cmd"),112 )113 .arg(arg("pattern"))114 .arg(arg("path"))115}116
41 unmodified lines
158 'f' or 'file': regular files\n \159 'd' or 'directory': directories\n \160 'l' or 'symlink': symbolic links");161 doc!(h, "exec"156 , "Execute each discovered path using the argument that follows as the command expression."157 , "Execute each discovered path using the argument that follows as the command \158 expression.\n \162 , "Execute the given command for each search result"163 , "Execute the given command for each search result.\n\164 The following are valid tokens that can be used within the expression for generating \165 commands:\n \166 '{}': places the input in the location of this token\n \167 '{.}': removes the extension from the input\n \
32 unmodified lines
modified:src/internal.rs+1 added-1 removed
100 unmodified lines
101 ranges.iter().any(|r| {102 r.start.is_uppercase() || r.end.is_uppercase()103 })104 }105 Expr::Group { ref e, .. } => expr_has_uppercase_char(e),105 Expr::Group { ref e, .. } |106 Expr::Repeat { ref e, .. } => expr_has_uppercase_char(e),107 Expr::Concat(ref es) => es.iter().any(expr_has_uppercase_char),108 Expr::Alternate(ref es) => es.iter().any(expr_has_uppercase_char),109 _ => false,
2 unmodified lines
modified:src/main.rs+2 added-2 removed
50 unmodified lines
51 let pattern = matches.value_of("pattern").unwrap_or(&empty_pattern);5253 // Get the current working directory54 let current_dir = Path::new(".");55 if !fshelper::is_dir(&current_dir) {55 if !fshelper::is_dir(current_dir) {56 error("Error: could not get current directory.");57 }5859 // Get the root directory for the search
42 unmodified lines
102 } else {103 None104 };105106 let command = matches.value_of("exec").map(|x| TokenizedCommand::new(&x));106 let command = matches.value_of("exec").map(|x| TokenizedCommand::new(x));107108 let config = FdOptions {109 case_sensitive,110 search_full_path: matches.is_present("full-path"),
43 unmodified lines
modified:src/walk.rs+5 added-5 removed
74 unmodified lines
7576 // Each spawned job will store it's thread handle in here.77 let mut handles = Vec::with_capacity(threads);78 for _ in 0..threads {79 let rx = shared_rx.clone();80 let cmd = cmd.clone();81 let out_perm = out_perm.clone();79 let rx = Arc::clone(&shared_rx);80 let cmd = Arc::clone(&cmd);81 let out_perm = Arc::clone(&out_perm);8283 // Spawn a job thread that will listen for and execute inputs.84 let handle = thread::spawn(move || exec::job(rx, cmd, out_perm));85
26 unmodified lines
112 // Have we reached the maximum time?113 if time::Instant::now() - start > max_buffer_time {114 // Flush the buffer115 for v in &buffer {116 output::print_entry(&v, &rx_config);116 output::print_entry(v, &rx_config);117 }118 buffer.clear();119120 // Start streaming
66 unmodified lines
187 }188 }189190 let search_str_o = if config.search_full_path {191 match fshelper::path_absolute_form(&entry_path) {191 match fshelper::path_absolute_form(entry_path) {192 Ok(path_abs_buf) => Some(path_abs_buf.to_string_lossy().into_owned().into()),193 Err(_) => error("Error: unable to get full path."),194 }195 } else {
21 unmodified lines
modified:Cargo.lock+1 added-1 removed
1[root]2name = "fd-find"3version = "4.0.0"3version = "5.0.0"4dependencies = [5 "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",6 "atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",7 "clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)",
369 unmodified lines
modified:Cargo.toml+1 added-1 removed
14 unmodified lines
15license = "MIT/Apache-2.0"16name = "fd-find"17readme = "README.md"18repository = "https://github.com/sharkdp/fd"19version = "4.0.0"19version = "5.0.0"2021[[bin]]22name = "fd"23path = "src/main.rs"
28 unmodified lines
modified:README.md+4 added-4 removed
169 unmodified lines
170FLAGS:171 -H, --hidden Search hidden files and directories172 -I, --no-ignore Do not respect .(git)ignore files173 -s, --case-sensitive Case-sensitive search (default: smart case)174 -i, --ignore-case Case-insensitive search (default: smart case)175 -a, --absolute-path Show absolute instead of relative paths176 -L, --follow Follow symbolic links177 -p, --full-path Search full path (default: file-/dirname only)178 -0, --print0 Separate results by the null character
3 unmodified lines
182OPTIONS:183 -d, --max-depth <depth> Set maximum search depth (default: none)184 -t, --type <filetype> Filter by type: f(ile), d(irectory), (sym)l(ink)185 -e, --extension <ext> Filter by file extension185 -c, --color <when> When to use color in the output:186 never, auto, always (default: auto)187 -j, --threads <num> Set number of threads to use for searching:188 (default: number of available CPU cores)186 -c, --color <when> When to use colors: never, *auto*, always187 -j, --threads <num> Set number of threads to use for searching & executing188 -x, --exec <cmd> Execute the given command for each search result189190ARGS:191 <pattern> the search pattern, a regular expression (optional)192 <path> the root directory for the filesystem search (optional)
162 unmodified lines