Skip to content
Myr

Merge remote-tracking branch 'origin/master' into no-strip/760

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

authored by David Peter · committed by David Peter · parents 06c58b9, 0484486 · Browse files · 19 files+443 added−117 removed
This commit

State

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

Diff stats

19 files+443 added−117 removed

  • tests:+67 added−0 removed
  • other:+376 added−117 removed

19 files+443 added−117 removed

deleted:.github/ISSUE_TEMPLATE/bug_report.md-28 removed
added:.github/ISSUE_TEMPLATE/bug_report.yaml+41 added
modified:contrib/completion/_fd+1 added
136 unmodified lines
137138 + '(exec-cmds)' # execute command139 '(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal'140 '(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal'141 '(long-listing max-results)--batch-size=[max number of args for each -X call]:size'142143 + other144 '!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)'145
124 unmodified lines
modified:doc/fd.1+41 added-9 removed
26 unmodified lines
27.SH OPTIONS28.TP29.B \-H, \-\-hidden30Include hidden files and directories in the search results31(default: hidden files and directories are skipped).31(default: hidden files and directories are skipped). The flag can be overridden with '--no-hidden'.32.TP33.B \-I, \-\-no\-ignore34Show search results from files and directories that would otherwise be ignored by35.RS
12 unmodified lines
48The global fd ignore file (usually49.I $HOME/.config/fd/ignore50)51.RE52.IP53The flag can be overridden with '--ignore'.54.TP55.B \-u, \-\-unrestricted56Alias for '--no-ignore'. Can be repeated; '-uu' is an alias for '--no-ignore --hidden'.57.TP
5 unmodified lines
63and the global gitignore configuration64.RI ( core.excludesFile65git setting, which defaults to66.IR $HOME/.config/git/ignore ).67The flag can be overridden with '--ignore-vcs'.68.TP69.B \-s, \-\-case\-sensitive70Perform a case-sensitive search. By default, fd uses case-insensitive searches, unless the71pattern contains an uppercase character (smart case).
14 unmodified lines
86performs substring comparison. If you want to match on an exact filename, consider using '\-\-glob'.87.TP88.B \-a, \-\-absolute\-path89Shows the full path starting from the root as opposed to relative paths.90The flag can be overridden with '--relative-path'.91.TP92.B \-l, \-\-list\-details93Use a detailed listing format like 'ls -l'. This is basically an alias94for '--exec-batch ls -l' with some additional 'ls' options. This can be used
1 unmodified line
96sort order.97.TP98.B \-L, \-\-follow99By default, fd does not descend into symlinked directories. Using this flag, symbolic links are96also traversed.100also traversed. The flag can be overridden with '--no-follow'.101.TP102.B \-p, \-\-full\-path103By default, the search pattern is only matched against the filename (or directory name). Using104this flag, the
52 unmodified lines
157.IP "d, directory"158directories159.IP "l, symlink"160symbolic links157.IP "x, executable"158executable (files)159.IP "e, empty"160empty files or directories161.IP "s, socket"162sockets163.IP "p, pipe"164named pipes (FIFOs)165.IP "x, executable"166executable (files)167.IP "e, empty"168empty files or directories169.RE170171.RS168This option can be used repeatedly to allow for multiple file types.172This option can be specified more than once to include multiple file types.173Searching for '--type file --type symlink' will show both regular files as well as174symlinks. Note that the 'executable' and 'empty' filters work differently: '--type175executable' implies '--type file' by default. And '--type empty' searches for176empty files and directories, unless either '--type file' or '--type directory' is177specified in addition.178179Examples:180 - Only search for files:181 fd --type file …182 fd -tf …183 - Find both files and symlinks184 fd --type file --type symlink …185 fd -tf -tl …186 - Find executable files:187 fd --type executable188 fd -tx189 - Find empty files:190 fd --type empty --type file191 fd -te -tf192 - Find empty directories:193 fd --type empty --type directory194 fd -te -td195.RE196.TP197.BI "\-e, \-\-extension " ext198Filter search results by file extension
69 unmodified lines
268.RE269.TP270.BI "\-\-changed-within " date|duration271Filter results based on the file modification time.246Files with modification times greater than or equal to the argument will be returned.272Files with modification times greater than the argument will be returned.273The argument can be provided as a duration (\fI10h, 1d, 35min\fR) or as a specific point274in time in either full RFC3339 format with time zone, or as a date or datetime in the275local time zone (\fIYYYY-MM-DD\fR or \fIYYYY-MM-DD HH:MM:SS\fR).276.B --change-newer-than
4 unmodified lines
281 \-\-change-newer-than "2018-10-27 10:00:00"282.TP283.BI "\-\-changed-before " date|duration284Filter results based on the file modification time.259Files with modification times less than or equal to the argument will be returned.285Files with modification times less than the argument will be returned.286The argument can be provided as a duration (\fI10h, 1d, 35min\fR) or as a specific point287in time in either full RFC3339 format with time zone, or as a date or datetime in the288local time zone (\fIYYYY-MM-DD\fR or \fIYYYY-MM-DD HH:MM:SS\fR).289.B --change-older-than
140 unmodified lines
430$ fd -e py431.TP432.RI "Open all search results with vim:"433$ fd pattern -X vim434.TP435.BI "\-\-batch\-size " size436Pass at most437.I size438arguments to each call to the command given with -X.439.TP440.SH SEE ALSO441.BR find (1)
modified:src/exec/job.rs+14 added-1 removed
48 unmodified lines
49 rx: Receiver<WorkerResult>,50 cmd: &CommandTemplate,51 show_filesystem_errors: bool,52 buffer_output: bool,53 limit: usize,54) -> ExitCode {55 let paths = rx.iter().filter_map(|value| match value {56 WorkerResult::Entry(val) => Some(val),57 WorkerResult::Error(err) => {
2 unmodified lines
60 }61 None62 }63 });63 cmd.generate_and_execute_batch(paths, buffer_output)64 if limit == 0 {65 // no limit66 return cmd.generate_and_execute_batch(paths, buffer_output);67 }6869 let mut exit_codes = Vec::new();70 let mut peekable = paths.peekable();71 while peekable.peek().is_some() {72 let limited = peekable.by_ref().take(limit);73 let exit_code = cmd.generate_and_execute_batch(limited, buffer_output);74 exit_codes.push(exit_code);75 }76 merge_exitcodes(exit_codes)77}
modified:src/exec/mod.rs+3 added-4 removed
8 unmodified lines
9use std::process::{Command, Stdio};10use std::sync::{Arc, Mutex};1112use anyhow::{anyhow, Result};13use lazy_static::lazy_static;13use once_cell::sync::Lazy;14use regex::Regex;1516use crate::exit_codes::ExitCode;17
52 unmodified lines
70 where71 I: IntoIterator<Item = S>,72 S: AsRef<str>,73 {74 lazy_static! {75 static ref PLACEHOLDER_PATTERN: Regex = Regex::new(r"\{(/?\.?|//)\}").unwrap();76 }74 static PLACEHOLDER_PATTERN: Lazy<Regex> =75 Lazy::new(|| Regex::new(r"\{(/?\.?|//)\}").unwrap());7677 let mut args = Vec::new();78 let mut has_placeholder = false;79
379 unmodified lines
modified:src/filter/size.rs+3 added-4 removed
1use lazy_static::lazy_static;1use once_cell::sync::Lazy;2use regex::Regex;34lazy_static! {5 static ref SIZE_CAPTURES: Regex = Regex::new(r"(?i)^([+-]?)(\d+)(b|[kmgt]i?b?)$").unwrap();6}4static SIZE_CAPTURES: Lazy<Regex> =5 Lazy::new(|| Regex::new(r"(?i)^([+-]?)(\d+)(b|[kmgt]i?b?)$").unwrap());67#[derive(Clone, Copy, Debug, PartialEq)]8pub enum SizeFilter {9 Max(u64),
202 unmodified lines
modified:src/filter/time.rs+2 added-2 removed
37 unmodified lines
38 }3940 pub fn applies_to(&self, t: &SystemTime) -> bool {41 match self {42 TimeFilter::Before(limit) => t <= limit,43 TimeFilter::After(limit) => t >= limit,42 TimeFilter::Before(limit) => t < limit,43 TimeFilter::After(limit) => t > limit,44 }45 }46}47
84 unmodified lines
modified:src/app.rs+102 added-13 removed
23 unmodified lines
24 .help("Search hidden files and directories")25 .long_help(26 "Include hidden directories and files in the search results (default: \27 hidden files and directories are skipped). Files and directories are \28 considered to be hidden if their name starts with a `.` sign (dot).",28 considered to be hidden if their name starts with a `.` sign (dot). \29 The flag can be overridden with --no-hidden.",30 ),31 )32 .arg(33 Arg::with_name("no-hidden")34 .long("no-hidden")35 .overrides_with("hidden")36 .hidden(true)37 .long_help(38 "Overrides --hidden.",39 ),40 )41 .arg(42 Arg::with_name("no-ignore")43 .long("no-ignore")44 .short("I")45 .overrides_with("no-ignore")46 .help("Do not respect .(git|fd)ignore files")47 .long_help(48 "Show search results from files and directories that would otherwise be \39 ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.",49 ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file. \50 The flag can be overridden with --ignore.",51 ),52 )53 .arg(54 Arg::with_name("ignore")55 .long("ignore")56 .overrides_with("no-ignore")57 .hidden(true)58 .long_help(59 "Overrides --no-ignore.",60 ),61 )62 .arg(63 Arg::with_name("no-ignore-vcs")64 .long("no-ignore-vcs")65 .overrides_with("no-ignore-vcs")66 .hidden_short_help(true)67 .help("Do not respect .gitignore files")68 .long_help(69 "Show search results from files and directories that would otherwise be \50 ignored by '.gitignore' files.",70 ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs.",71 ),72 )73 .arg(74 Arg::with_name("ignore-vcs")75 .long("ignore-vcs")76 .overrides_with("no-ignore-vcs")77 .hidden(true)78 .long_help(79 "Overrides --no-ignore-vcs.",80 ),81 )82 .arg(83 Arg::with_name("no-ignore-parent")84 .long("no-ignore-parent")85 .overrides_with("no-ignore-parent")86 .hidden_short_help(true)
13 unmodified lines
100 .arg(101 Arg::with_name("rg-alias-hidden-ignore")102 .short("u")103 .long("unrestricted")104 .overrides_with_all(&["ignore", "no-hidden"])105 .multiple(true)106 .hidden_short_help(true)107 .help("Alias for '--no-ignore', and '--hidden' when given twice")108 .long_help(
65 unmodified lines
174 .short("a")175 .overrides_with("absolute-path")176 .help("Show absolute instead of relative paths")177 .long_help(148 "Shows the full path starting from the root as opposed to relative paths.",178 "Shows the full path starting from the root as opposed to relative paths. \179 The flag can be overridden with --relative-path.",180 ),181 )182 .arg(183 Arg::with_name("relative-path")184 .long("relative-path")185 .overrides_with("absolute-path")186 .hidden(true)187 .long_help(188 "Overrides --absolute-path.",189 ),190 )191 .arg(192 Arg::with_name("list-details")193 .long("list-details")194 .short("l")195 .conflicts_with("absolute-path")
13 unmodified lines
209 .overrides_with("follow")210 .help("Follow symbolic links")211 .long_help(212 "By default, fd does not descend into symlinked directories. Using this \173 flag, symbolic links are also traversed.",213 flag, symbolic links are also traversed. \214 Flag can be overriden with --no-follow.",215 ),216 )217 .arg(218 Arg::with_name("no-follow")219 .long("no-follow")220 .overrides_with("follow")221 .hidden(true)222 .long_help(223 "Overrides --follow.",224 ),225 )226 .arg(227 Arg::with_name("full-path")228 .long("full-path")229 .short("p")230 .overrides_with("full-path")181 .help("Search full path (default: file-/dirname only)")231 .help("Search full abs. path (default: filename only)")232 .long_help(233 "By default, the search pattern is only matched against the filename (or \184 directory name). Using this flag, the pattern is matched against the \185 full path.",234 directory name). Using this flag, the pattern is matched against the full \235 (absolute) path. Example:\n \236 fd --glob -p '**/.git/config'",237 ),238 )239 .arg(240 Arg::with_name("null_separator")
58 unmodified lines
299 .long("prune")300 .conflicts_with_all(&["size", "exact-depth"])301 .hidden_short_help(true)302 .help("Do not traverse into matching directories")252 .long_help("Do not traverse into matching directories.")303 .long_help("Do not traverse into directories that match the search criteria. If \304 you want to exclude specific directories, use the '--exclude=…' option.")305 )306 .arg(307 Arg::with_name("file-type")308 .long("type")
23 unmodified lines
332 "Filter by type: file (f), directory (d), symlink (l),\nexecutable (x), \333 empty (e), socket (s), pipe (p)",334 )335 .long_help(284 "Filter the search by type (multiple allowable filetypes can be specified):\n \336 "Filter the search by type:\n \337 'f' or 'file': regular files\n \338 'd' or 'directory': directories\n \339 'l' or 'symlink': symbolic links\n \288 'x' or 'executable': executables\n \289 'e' or 'empty': empty files or directories\n \340 's' or 'socket': socket\n \291 'p' or 'pipe': named pipe (FIFO)",341 'p' or 'pipe': named pipe (FIFO)\n\n \342 'x' or 'executable': executables\n \343 'e' or 'empty': empty files or directories\n\n\344 This option can be specified more than once to include multiple file types. \345 Searching for '--type file --type symlink' will show both regular files as \346 well as symlinks. Note that the 'executable' and 'empty' filters work differently: \347 '--type executable' implies '--type file' by default. And '--type empty' searches \348 for empty files and directories, unless either '--type file' or '--type directory' \349 is specified in addition.\n\n\350 Examples:\n \351 - Only search for files:\n \352 fd --type file …\n \353 fd -tf …\n \354 - Find both files and symlinks\n \355 fd --type file --type symlink …\n \356 fd -tf -tl …\n \357 - Find executable files:\n \358 fd --type executable\n \359 fd -tx\n \360 - Find empty files:\n \361 fd --type empty --type file\n \362 fd -te -tf\n \363 - Find empty directories:\n \364 fd --type empty --type directory\n \365 fd -te -td"366 ),367 )368 .arg(369 Arg::with_name("extension")
69 unmodified lines
439 "440 ),441 )442 .arg(443 Arg::with_name("batch-size")444 .long("batch-size")445 .takes_value(true)446 .value_name("size")447 .hidden_short_help(true)448 .requires("exec-batch")449 .help("Max number of arguments to run as a batch with -X")450 .long_help(451 "Maximum number of arguments to pass to the command given with -X. \452 If the number of results is greater than the given size, \453 the command given with -X is run again with remaining arguments. \454 A batch size of zero means there is no limit.",455 ),456 )457 .arg(458 Arg::with_name("exclude")459 .long("exclude")460 .short("E")461 .takes_value(true)
299 unmodified lines
modified:src/config.rs+4 added
83 unmodified lines
8485 /// If a value is supplied, each item found will be used to generate and execute commands.86 pub command: Option<Arc<CommandTemplate>>,8788 /// Maximum number of search results to pass to each `command`. If zero, the number is89 /// unlimited.90 pub batch_size: usize,9192 /// A list of glob patterns that should be excluded from the search.93 pub exclude_patterns: Vec<String>,9495 /// A list of custom ignore files.
24 unmodified lines
modified:src/exit_codes.rs+20 added
1use std::process;23#[cfg(unix)]4use nix::sys::signal::{raise, signal, SigHandler, Signal};56#[derive(Debug, Clone, Copy, PartialEq)]7pub enum ExitCode {8 Success,9 HasResults(bool),
15 unmodified lines
25impl ExitCode {26 fn is_error(self) -> bool {27 i32::from(self) != 028 }2930 /// Exit the process with the appropriate code.31 pub fn exit(self) -> ! {32 #[cfg(unix)]33 if self == ExitCode::KilledBySigint {34 // Get rid of the SIGINT handler, if present, and raise SIGINT35 unsafe {36 if signal(Signal::SIGINT, SigHandler::SigDfl).is_ok() {37 let _ = raise(Signal::SIGINT);38 }39 }40 }4142 process::exit(self.into())43 }44}4546pub fn merge_exitcodes(results: impl IntoIterator<Item = ExitCode>) -> ExitCode {47 if results.into_iter().any(ExitCode::is_error) {
47 unmodified lines
modified:src/main.rs+8 added-3 removed
10 unmodified lines
11mod walk;1213use std::env;14use std::path::{Path, PathBuf};15use std::process;15use std::sync::Arc;16use std::time;1718use anyhow::{anyhow, Context, Result};
33 unmodified lines
52fn main() {53 let result = run();54 match result {55 Ok(exit_code) => {57 process::exit(exit_code.into());56 exit_code.exit();57 }58 Err(err) => {59 eprintln!("[fd error]: {:#}", err);61 process::exit(ExitCode::GeneralError.into());60 ExitCode::GeneralError.exit();61 }62 }63}64
281 unmodified lines
346 .build()347 })348 .transpose()?,349 command: command.map(Arc::new),350 batch_size: matches351 .value_of("batch-size")352 .map(|n| n.parse::<usize>())353 .transpose()354 .context("Failed to parse --batch-size argument")?355 .unwrap_or_default(),356 exclude_patterns: matches357 .values_of("exclude")358 .map(|v| v.map(|p| String::from("!") + p).collect())359 .unwrap_or_else(Vec::new),
209 unmodified lines
modified:src/output.rs+39 added-20 removed
1use std::borrow::Cow;2use std::io::{self, StdoutLock, Write};3use std::path::Path;3use std::process;4use std::sync::atomic::{AtomicBool, Ordering};5use std::sync::Arc;67use lscolors::{LsColors, Style};7use lscolors::{Indicator, LsColors, Style};89use crate::config::Config;10use crate::error::print_error;11use crate::exit_codes::ExitCode;
24 unmodified lines
3637 if let Err(e) = r {38 if e.kind() == ::std::io::ErrorKind::BrokenPipe {39 // Exit gracefully in case of a broken pipe (e.g. 'fd ... | head -n 3').40 process::exit(0);40 ExitCode::Success.exit();41 } else {42 print_error(format!("Could not write to output: {}", e));43 process::exit(ExitCode::GeneralError.into());43 ExitCode::GeneralError.exit();44 }45 }46}47
4 unmodified lines
52 config: &Config,53 ls_colors: &LsColors,54 wants_to_quit: &Arc<AtomicBool>,55) -> io::Result<()> {56 let default_style = ansi_term::Style::default();56 // Split the path between the parent and the last component57 let mut offset = 0;58 let path_str = path.to_string_lossy();5958 // Traverse the path and colorize each component59 for (component, style) in ls_colors.style_for_path_components(path) {60 let style = style61 .map(Style::to_ansi_term_style)62 .unwrap_or(default_style);60 if let Some(parent) = path.parent() {61 offset = parent.to_string_lossy().len();62 for c in path_str[offset..].chars() {63 if std::path::is_separator(c) {64 offset += c.len_utf8();65 } else {66 break;67 }68 }69 }7064 let mut path_string = component.to_string_lossy();71 if offset > 0 {72 let mut parent_str = Cow::from(&path_str[..offset]);73 if let Some(ref separator) = config.path_separator {66 *path_string.to_mut() = replace_path_separator(&path_string, separator);74 *parent_str.to_mut() = replace_path_separator(&parent_str, separator);75 }68 write!(stdout, "{}", style.paint(path_string))?;7670 // TODO: can we move this out of the if-statement? Why do we call it that often?71 if wants_to_quit.load(Ordering::Relaxed) {72 writeln!(stdout)?;73 process::exit(ExitCode::KilledBySigint.into());74 }77 let style = ls_colors78 .style_for_indicator(Indicator::Directory)79 .map(Style::to_ansi_term_style)80 .unwrap_or_default();81 write!(stdout, "{}", style.paint(parent_str))?;82 }8384 let style = ls_colors85 .style_for_path(path)86 .map(Style::to_ansi_term_style)87 .unwrap_or_default();88 write!(stdout, "{}", style.paint(&path_str[offset..]))?;8990 if config.null_separator {78 write!(stdout, "\0")91 write!(stdout, "\0")?;92 } else {80 writeln!(stdout)93 writeln!(stdout)?;94 }9596 if wants_to_quit.load(Ordering::Relaxed) {97 ExitCode::KilledBySigint.exit();98 }99100 Ok(())101}102103// TODO: this function is performance critical and can probably be optimized104fn print_entry_uncolorized_base(
40 unmodified lines
modified:src/walk.rs+9 added-6 removed
1 unmodified line
2use std::ffi::OsStr;3use std::fs::{FileType, Metadata};4use std::io;5use std::path::{Path, PathBuf};6use std::process;6use std::sync::atomic::{AtomicBool, Ordering};7use std::sync::mpsc::{channel, Receiver, Sender};8use std::sync::{Arc, Mutex};9use std::thread;
125 unmodified lines
135 let wants_to_quit = Arc::new(AtomicBool::new(false));136 if config.ls_colors.is_some() && config.command.is_none() {137 let wq = Arc::clone(&wants_to_quit);138 ctrlc::set_handler(move || {140 if wq.load(Ordering::Relaxed) {139 if wq.fetch_or(true, Ordering::Relaxed) {140 // Ctrl-C has been pressed twice, exit NOW142 process::exit(ExitCode::KilledBySigint.into());143 } else {144 wq.store(true, Ordering::Relaxed);141 ExitCode::KilledBySigint.exit();142 }143 })144 .unwrap();145 }
29 unmodified lines
175 thread::spawn(move || {176 // This will be set to `Some` if the `--exec` argument was supplied.177 if let Some(ref cmd) = config.command {178 if cmd.in_batch_mode() {182 exec::batch(rx, cmd, show_filesystem_errors, enable_output_buffering)179 exec::batch(180 rx,181 cmd,182 show_filesystem_errors,183 enable_output_buffering,184 config.batch_size,185 )186 } else {187 let shared_rx = Arc::new(Mutex::new(rx));188189 let out_perm = Arc::new(Mutex::new(()));
333 unmodified lines
modified:tests/tests.rs+67 added
2 unmodified lines
3use std::fs;4use std::io::Write;5use std::path::Path;6use std::time::{Duration, SystemTime};7use test_case::test_case;89use normpath::PathExt;10use regex::escape;11
1406 unmodified lines
1418 );1419 }1420}14211422#[test]1423fn test_exec_batch_with_limit() {1424 // TODO Test for windows1425 if cfg!(windows) {1426 return;1427 }14281429 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);14301431 te.assert_output(1432 &["foo", "--batch-size", "0", "--exec-batch", "echo", "{}"],1433 "./a.foo ./one/b.foo ./one/two/C.Foo2 ./one/two/c.foo ./one/two/three/d.foo ./one/two/three/directory_foo",1434 );14351436 let output = te.assert_success_and_get_output(1437 ".",1438 &["foo", "--batch-size=2", "--exec-batch", "echo", "{}"],1439 );1440 let stdout = String::from_utf8_lossy(&output.stdout);14411442 for line in stdout.lines() {1443 assert_eq!(2, line.split_whitespace().count());1444 }14451446 let mut paths: Vec<_> = stdout1447 .lines()1448 .flat_map(|line| line.split_whitespace())1449 .collect();1450 paths.sort_unstable();1451 assert_eq!(1452 &paths,1453 &[1454 "./a.foo",1455 "./one/b.foo",1456 "./one/two/C.Foo2",1457 "./one/two/c.foo",1458 "./one/two/three/d.foo",1459 "./one/two/three/directory_foo"1460 ],1461 );1462}14631464/// Shell script execution (--exec) with a custom --path-separator1465#[test]1466fn test_exec_with_separator() {1467 let (te, abs_path) = get_test_env_with_abs_path(DEFAULT_DIRS, DEFAULT_FILES);
473 unmodified lines
19411942 te.assert_failure(&["--max-results=a"]);1943}19441945#[test_case("--hidden", &["--no-hidden"] ; "hidden")]1946#[test_case("--no-ignore", &["--ignore"] ; "no-ignore")]1947#[test_case("--no-ignore-vcs", &["--ignore-vcs"] ; "no-ignore-vcs")]1948#[test_case("--follow", &["--no-follow"] ; "follow")]1949#[test_case("--absolute-path", &["--relative-path"] ; "absolute-path")]1950#[test_case("-u", &["--ignore"] ; "u")]1951#[test_case("-uu", &["--ignore", "--no-hidden"] ; "uu")]1952fn test_opposing(flag: &str, opposing_flags: &[&str]) {1953 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);19541955 let mut flags = vec![flag];1956 flags.extend_from_slice(opposing_flags);1957 let out_no_flags = te.assert_success_and_get_output(".", &[]);1958 let out_opposing_flags = te.assert_success_and_get_output(".", &flags);19591960 assert_eq!(1961 out_no_flags,1962 out_opposing_flags,1963 "{} should override {}",1964 opposing_flags.join(" "),1965 flag1966 );1967}19681969/// Print error if search pattern starts with a dot and --hidden is not set1970/// (Unix only, hidden files on Windows work differently)1971#[test]1972#[cfg(unix)]
30 unmodified lines
modified:Cargo.lock+70 added-21 removed
29 unmodified lines
30]3132[[package]]33name = "anyhow"34version = "1.0.44"34version = "1.0.45"35source = "registry+https://github.com/rust-lang/crates.io-index"36checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"36checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7"3738[[package]]39name = "atty"40version = "0.2.14"
12 unmodified lines
53checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"5455[[package]]56name = "bitflags"57version = "1.2.1"57version = "1.3.2"58source = "registry+https://github.com/rust-lang/crates.io-index"59checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"59checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"6061[[package]]62name = "bstr"63version = "0.2.16"63version = "0.2.17"64source = "registry+https://github.com/rust-lang/crates.io-index"65checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"65checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"66dependencies = [67 "memchr",68]6970[[package]]71name = "cc"72version = "1.0.70"72version = "1.0.72"73source = "registry+https://github.com/rust-lang/crates.io-index"74checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"74checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"7576[[package]]77name = "cfg-if"78version = "1.0.0"
40 unmodified lines
119]120121[[package]]122name = "ctrlc"123version = "3.2.0"123version = "3.2.1"124source = "registry+https://github.com/rust-lang/crates.io-index"125checksum = "377c9b002a72a0b2c1a18c62e2f3864bdfea4a015e3683a96e24aa45dd6c02d1"125checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf"126dependencies = [127 "nix",128 "winapi",129]
41 unmodified lines
171 "globset",172 "humantime",173 "ignore",174 "jemallocator",175 "lazy_static",175 "libc",176 "lscolors",177 "nix",178 "normpath",179 "num_cpus",180 "once_cell",181 "regex",182 "regex-syntax",183 "tempdir",184 "test-case",185 "users",186 "version_check",187]188
112 unmodified lines
301checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"302303[[package]]304name = "libc"304version = "0.2.103"305version = "0.2.107"306source = "registry+https://github.com/rust-lang/crates.io-index"306checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"307checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"308309[[package]]310name = "log"311version = "0.4.14"
4 unmodified lines
316]317318[[package]]319name = "lscolors"319version = "0.7.1"320version = "0.8.1"321source = "registry+https://github.com/rust-lang/crates.io-index"321checksum = "d24b894c45c9da468621cdd615a5a79ee5e5523dd4f75c76ebc03d458940c16e"322checksum = "9dd58d8727f3035fa6d5272f16b519741fd4875936b99d8a7cde21291b7d9174"323dependencies = [324 "ansi_term 0.12.1",325]326
13 unmodified lines
340]341342[[package]]343name = "nix"343version = "0.22.1"344version = "0.23.0"345source = "registry+https://github.com/rust-lang/crates.io-index"345checksum = "e7555d6c7164cc913be1ce7f95cbecdabda61eb2ccd89008524af306fb7f5031"346checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"347dependencies = [348 "bitflags",349 "cc",350 "cfg-if",
2 unmodified lines
353]354355[[package]]356name = "normpath"356version = "0.3.0"357version = "0.3.1"358source = "registry+https://github.com/rust-lang/crates.io-index"358checksum = "27e6e8f70e9fbbe3752d330d769e3424f24b9458ce266df93a3b456902fd696a"359checksum = "640c20e9df4a2d4a5adad5b47e17d76dac3e824346b181931c3ec9f7a85687b1"360dependencies = [361 "winapi",362]363
32 unmodified lines
396source = "registry+https://github.com/rust-lang/crates.io-index"397checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"398399[[package]]400name = "proc-macro2"401version = "1.0.32"402source = "registry+https://github.com/rust-lang/crates.io-index"403checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"404dependencies = [405 "unicode-xid",406]407408[[package]]409name = "quote"410version = "1.0.10"411source = "registry+https://github.com/rust-lang/crates.io-index"412checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"413dependencies = [414 "proc-macro2",415]416417[[package]]418name = "rand"419version = "0.4.6"420source = "registry+https://github.com/rust-lang/crates.io-index"421checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
89 unmodified lines
511source = "registry+https://github.com/rust-lang/crates.io-index"512checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"513514[[package]]515name = "syn"516version = "1.0.81"517source = "registry+https://github.com/rust-lang/crates.io-index"518checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"519dependencies = [520 "proc-macro2",521 "quote",522 "unicode-xid",523]524525[[package]]526name = "tempdir"527version = "0.3.7"528source = "registry+https://github.com/rust-lang/crates.io-index"529checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
12 unmodified lines
542 "winapi",543]544545[[package]]546name = "test-case"547version = "1.2.1"548source = "registry+https://github.com/rust-lang/crates.io-index"549checksum = "c7cad0a06f9a61e94355aa3b3dc92d85ab9c83406722b1ca5e918d4297c12c23"550dependencies = [551 "cfg-if",552 "proc-macro2",553 "quote",554 "syn",555 "version_check",556]557558[[package]]559name = "textwrap"560version = "0.11.0"561source = "registry+https://github.com/rust-lang/crates.io-index"562checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
22 unmodified lines
585]586587[[package]]588name = "unicode-width"546version = "0.1.8"589version = "0.1.9"590source = "registry+https://github.com/rust-lang/crates.io-index"548checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"591checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"592593[[package]]594name = "unicode-xid"595version = "0.2.2"596source = "registry+https://github.com/rust-lang/crates.io-index"597checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"598599[[package]]600name = "users"601version = "0.11.0"602source = "registry+https://github.com/rust-lang/crates.io-index"603checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
64 unmodified lines
modified:Cargo.toml+4 added-3 removed
35 unmodified lines
36[dependencies]37ansi_term = "0.12"38atty = "0.2"39ignore = "0.4.3"40lazy_static = "1.1.0"40num_cpus = "1.8"41regex = "1.5.4"42regex-syntax = "0.6"43ctrlc = "3.2"44humantime = "2.1"46lscolors = "0.7"45lscolors = "0.8"46globset = "0.4"47anyhow = "1.0"48dirs-next = "2.0"49normpath = "0.3"
5 unmodified lines
55features = ["suggestions", "color", "wrap_help"]5657[target.'cfg(unix)'.dependencies]58users = "0.11.0"59nix = "0.23.0"6061[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies]62libc = "0.2"63
5 unmodified lines
6970[dev-dependencies]71diff = "0.1"72tempdir = "0.3"73filetime = "0.2.15"73filetime = "0.2"74test-case = "1.2"7576[profile.release]77lto = true78codegen-units = 1
modified:CHANGELOG.md+7 added-2 removed
2 unmodified lines
3## Performance improvements45- File metadata is now cached between the different filters that require it (e.g. `--owner`,6 `--size`), reducing the number of `stat` syscalls when multiple filters are used; see #8637- Colorized output is now significantly faster, see #720 and #853 (@tavianator)89## Features9- Don't buffer command output from `--exec` when using a single thread. See #5221011- Don't buffer command output from `--exec` when using a single thread. See #52212- Add new `-q, --quiet` flag, see #303 (@Asha20)1213- Add new `--no-ignore-parent` flag, see #787 (@will459)14- Add new `--batch-size` flag, see #410 (@devonhollowood)15- Add opposing command-line options, see #595 (@Asha20)16- Add support for more filesystem indicators in `LS_COLORS`, see17 https://github.com/sharkdp/lscolors/pull/35 (@tavianator)1819## Bugfixes2021- Always show the `./` prefix for search results unless the output is a TTY or `--strip-cwd-prefix` is set, see #760 and #861 (@jcaplan)
4 unmodified lines
26- Use local time zone for time functions (`--change-newer-than`, `--change-older-than`), see #631 (@jacobmischka)27- Support `--list-details` on more platforms (like BusyBox), see #78328- The filters `--owner`, `--size`, and `--changed-{within,before}` now apply to symbolic links29 themselves, rather than the link target, except when `--follow` is specified; see #86330- Change time comparisons to be exclusive, see #794 (@jacobmischka)3132## Changes3334- Apply custom `--path-separator` to commands run with `--exec(-batch)` and `--list-details`, see #697 (@aswild)
509 unmodified lines
modified:README.md+8 added-1 removed
416 unmodified lines
417> fd -- '-pattern'418> fd '[-]pattern'419```420421### "Command not found" for `alias`es or shell functions422423Shell `alias`es and shell functions can not be used for command execution via `fd -x` or424`fd -X`. In `zsh`, you can make the alias global via `alias -g myalias="…"`. In `bash`,425you can use `export -f my_function` to make available to child processes. You would still426need to call `fd -x bash -c 'my_function "$1"' bash`. For other use cases or shells, use427a (temporary) shell script.428429## Integration with other programs430431### Using fd with `fzf`432
241 unmodified lines
674675- [sharkdp](https://github.com/sharkdp)676- [tmccombs](https://github.com/tmccombs)677- [tavianator](https://github.com/tavianator)670- [pemistahl](https://github.com/pemistahl/)678679## License680681Copyright (c) 2017-2021 The fd developers
4 unmodified lines