2017-10-04 14:31:08 +02:00
|
|
|
mod app;
|
2020-04-03 21:24:11 +02:00
|
|
|
mod error;
|
2017-10-14 18:04:11 +02:00
|
|
|
mod exec;
|
2018-10-03 11:25:16 +02:00
|
|
|
mod exit_codes;
|
2020-04-03 12:04:47 +02:00
|
|
|
mod filesystem;
|
2020-04-03 11:34:34 +02:00
|
|
|
mod filetypes;
|
2020-04-03 11:36:54 +02:00
|
|
|
mod filter;
|
2020-04-03 11:39:32 +02:00
|
|
|
mod options;
|
2017-10-10 08:01:17 +02:00
|
|
|
mod output;
|
2020-04-03 11:44:45 +02:00
|
|
|
mod regex_helper;
|
2017-10-10 08:01:17 +02:00
|
|
|
mod walk;
|
2017-05-12 11:50:03 +02:00
|
|
|
|
|
|
|
use std::env;
|
2017-10-14 19:57:15 +02:00
|
|
|
use std::path::{Path, PathBuf};
|
2019-09-13 22:26:27 +02:00
|
|
|
use std::process;
|
2017-06-11 22:43:30 +02:00
|
|
|
use std::sync::Arc;
|
2017-06-16 10:37:40 +02:00
|
|
|
use std::time;
|
2017-05-12 11:50:03 +02:00
|
|
|
|
2020-04-03 20:55:14 +02:00
|
|
|
use anyhow::{anyhow, Context, Result};
|
2017-06-10 17:30:48 +02:00
|
|
|
use atty::Stream;
|
2020-04-15 15:47:17 +02:00
|
|
|
use globset::GlobBuilder;
|
2018-12-09 14:56:05 +01:00
|
|
|
use lscolors::LsColors;
|
2019-09-15 14:42:48 +02:00
|
|
|
use regex::bytes::{RegexBuilder, RegexSetBuilder};
|
2017-05-12 13:02:20 +02:00
|
|
|
|
2019-01-05 18:17:22 +01:00
|
|
|
use crate::exec::CommandTemplate;
|
2020-04-03 20:55:14 +02:00
|
|
|
use crate::exit_codes::ExitCode;
|
2020-04-03 11:34:34 +02:00
|
|
|
use crate::filetypes::FileTypes;
|
2020-04-03 11:36:54 +02:00
|
|
|
use crate::filter::{SizeFilter, TimeFilter};
|
2020-04-03 11:39:32 +02:00
|
|
|
use crate::options::Options;
|
2020-04-03 11:44:45 +02:00
|
|
|
use crate::regex_helper::pattern_has_uppercase_char;
|
2017-05-12 11:50:03 +02:00
|
|
|
|
2019-09-15 18:13:29 +02:00
|
|
|
// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481
|
2019-09-15 18:30:13 +02:00
|
|
|
#[cfg(all(not(windows), not(target_env = "musl")))]
|
2019-09-15 17:47:36 +02:00
|
|
|
#[global_allocator]
|
|
|
|
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
|
|
|
|
2020-04-03 20:55:14 +02:00
|
|
|
fn run() -> Result<ExitCode> {
|
2020-04-03 12:00:44 +02:00
|
|
|
let matches = app::build_app().get_matches_from(env::args_os());
|
2017-05-12 11:50:03 +02:00
|
|
|
|
2019-11-20 10:53:51 +01:00
|
|
|
// Set the current working directory of the process
|
2020-04-04 11:40:27 +02:00
|
|
|
if let Some(base_directory) = matches.value_of_os("base-directory") {
|
2020-04-03 19:41:43 +02:00
|
|
|
let base_directory = Path::new(base_directory);
|
|
|
|
if !filesystem::is_dir(base_directory) {
|
2020-04-03 20:55:14 +02:00
|
|
|
return Err(anyhow!(
|
|
|
|
"The '--base-directory' path '{}' is not a directory.",
|
2020-04-03 19:41:43 +02:00
|
|
|
base_directory.to_string_lossy()
|
2020-04-03 20:55:14 +02:00
|
|
|
));
|
2019-11-20 10:53:51 +01:00
|
|
|
}
|
2020-04-03 20:55:14 +02:00
|
|
|
env::set_current_dir(base_directory).with_context(|| {
|
|
|
|
format!(
|
|
|
|
"Could not set '{}' as the current working directory.",
|
|
|
|
base_directory.to_string_lossy()
|
|
|
|
)
|
|
|
|
})?;
|
2019-11-20 10:53:51 +01:00
|
|
|
}
|
|
|
|
|
2020-04-03 19:41:43 +02:00
|
|
|
let current_directory = Path::new(".");
|
|
|
|
if !filesystem::is_dir(current_directory) {
|
2020-04-03 20:55:14 +02:00
|
|
|
return Err(anyhow!(
|
|
|
|
"Could not retrieve current directory (has it been deleted?)."
|
|
|
|
));
|
2017-10-14 19:57:15 +02:00
|
|
|
}
|
2017-05-12 11:50:03 +02:00
|
|
|
|
2020-04-03 19:41:43 +02:00
|
|
|
// Get the search pattern
|
2020-04-04 11:40:27 +02:00
|
|
|
let pattern = matches
|
|
|
|
.value_of_os("pattern")
|
|
|
|
.map(|p| {
|
|
|
|
p.to_str().ok_or(anyhow!(
|
|
|
|
"The search pattern includes invalid UTF-8 sequences."
|
|
|
|
))
|
|
|
|
})
|
|
|
|
.transpose()?
|
|
|
|
.unwrap_or("");
|
2020-04-03 19:41:43 +02:00
|
|
|
|
2018-03-14 22:49:53 +01:00
|
|
|
// Get one or more root directories to search.
|
2018-10-20 20:24:53 +02:00
|
|
|
let mut dir_vec: Vec<_> = match matches
|
2020-04-04 11:40:27 +02:00
|
|
|
.values_of_os("path")
|
|
|
|
.or_else(|| matches.values_of_os("search-path"))
|
2018-10-20 20:24:53 +02:00
|
|
|
{
|
2018-01-01 12:16:43 +01:00
|
|
|
Some(paths) => paths
|
|
|
|
.map(|path| {
|
|
|
|
let path_buffer = PathBuf::from(path);
|
2020-04-03 20:55:14 +02:00
|
|
|
if filesystem::is_dir(&path_buffer) {
|
|
|
|
Ok(path_buffer)
|
|
|
|
} else {
|
|
|
|
Err(anyhow!(
|
|
|
|
"Search path '{}' is not a directory.",
|
2018-01-01 12:16:43 +01:00
|
|
|
path_buffer.to_string_lossy()
|
2020-04-03 20:55:14 +02:00
|
|
|
))
|
2018-01-01 12:16:43 +01:00
|
|
|
}
|
2018-09-27 23:01:38 +02:00
|
|
|
})
|
2020-04-03 20:55:14 +02:00
|
|
|
.collect::<Result<Vec<_>>>()?,
|
2020-04-03 19:41:43 +02:00
|
|
|
None => vec![current_directory.to_path_buf()],
|
2017-06-11 20:41:32 +02:00
|
|
|
};
|
|
|
|
|
2017-12-06 23:52:23 +01:00
|
|
|
if matches.is_present("absolute-path") {
|
|
|
|
dir_vec = dir_vec
|
|
|
|
.iter()
|
2018-03-25 23:47:58 +02:00
|
|
|
.map(|path_buffer| {
|
|
|
|
path_buffer
|
|
|
|
.canonicalize()
|
2020-04-03 12:04:47 +02:00
|
|
|
.and_then(|pb| filesystem::absolute_path(pb.as_path()))
|
2018-03-25 23:47:58 +02:00
|
|
|
.unwrap()
|
2018-09-27 23:01:38 +02:00
|
|
|
})
|
|
|
|
.collect();
|
2017-10-14 19:57:15 +02:00
|
|
|
}
|
2017-06-05 16:25:13 +02:00
|
|
|
|
2018-03-14 23:13:17 +01:00
|
|
|
// Detect if the user accidentally supplied a path instead of a search pattern
|
2018-05-14 18:39:47 +02:00
|
|
|
if !matches.is_present("full-path")
|
|
|
|
&& pattern.contains(std::path::MAIN_SEPARATOR)
|
2020-04-03 12:04:47 +02:00
|
|
|
&& filesystem::is_dir(Path::new(pattern))
|
2018-03-14 23:13:17 +01:00
|
|
|
{
|
2020-04-03 20:55:14 +02:00
|
|
|
return Err(anyhow!(
|
2018-10-27 16:30:29 +02:00
|
|
|
"The search pattern '{pattern}' contains a path-separation character ('{sep}') \
|
2018-03-14 23:13:17 +01:00
|
|
|
and will not lead to any search results.\n\n\
|
|
|
|
If you want to search for all files inside the '{pattern}' directory, use a match-all pattern:\n\n \
|
|
|
|
fd . '{pattern}'\n\n\
|
2020-04-03 20:55:14 +02:00
|
|
|
Instead, if you want your pattern to match the full file path, use:\n\n \
|
2018-03-14 23:13:17 +01:00
|
|
|
fd --full-path '{pattern}'",
|
|
|
|
pattern = pattern,
|
|
|
|
sep = std::path::MAIN_SEPARATOR,
|
2020-04-03 20:55:14 +02:00
|
|
|
));
|
2018-03-14 23:13:17 +01:00
|
|
|
}
|
|
|
|
|
2019-09-15 15:37:08 +02:00
|
|
|
let pattern_regex = if matches.is_present("glob") {
|
2020-04-15 15:47:17 +02:00
|
|
|
let glob = GlobBuilder::new(pattern).literal_separator(true).build()?;
|
2019-09-15 15:37:08 +02:00
|
|
|
glob.regex().to_owned()
|
|
|
|
} else if matches.is_present("fixed-strings") {
|
|
|
|
// Treat pattern as literal string if '--fixed-strings' is used
|
2018-02-10 15:19:53 +01:00
|
|
|
regex::escape(pattern)
|
|
|
|
} else {
|
|
|
|
String::from(pattern)
|
|
|
|
};
|
|
|
|
|
2017-06-05 14:14:01 +02:00
|
|
|
// The search will be case-sensitive if the command line flag is set or
|
|
|
|
// if the pattern has an uppercase character (smart case).
|
2018-01-01 12:16:43 +01:00
|
|
|
let case_sensitive = !matches.is_present("ignore-case")
|
2018-02-10 15:19:53 +01:00
|
|
|
&& (matches.is_present("case-sensitive") || pattern_has_uppercase_char(&pattern_regex));
|
2017-06-05 14:14:01 +02:00
|
|
|
|
2020-04-04 12:51:15 +02:00
|
|
|
let interactive_terminal = atty::is(Stream::Stdout);
|
2017-09-30 23:02:57 +02:00
|
|
|
let colored_output = match matches.value_of("color") {
|
|
|
|
Some("always") => true,
|
|
|
|
Some("never") => false,
|
2020-04-04 12:51:15 +02:00
|
|
|
_ => env::var_os("NO_COLOR").is_none() && interactive_terminal,
|
2017-09-30 23:02:57 +02:00
|
|
|
};
|
2017-10-26 21:44:40 +02:00
|
|
|
|
2019-04-12 02:16:02 +02:00
|
|
|
let path_separator = matches.value_of("path-separator").map(|str| str.to_owned());
|
2019-04-11 00:30:56 +02:00
|
|
|
|
2017-10-20 09:15:32 +02:00
|
|
|
#[cfg(windows)]
|
2020-04-15 18:47:18 +02:00
|
|
|
ansi_term::enable_ansi_support().ok();
|
2017-05-15 21:41:31 +02:00
|
|
|
|
2017-10-12 08:01:51 +02:00
|
|
|
let ls_colors = if colored_output {
|
2018-12-09 14:56:05 +01:00
|
|
|
Some(LsColors::from_env().unwrap_or_default())
|
2017-10-12 08:01:51 +02:00
|
|
|
} else {
|
|
|
|
None
|
|
|
|
};
|
2017-05-12 15:44:09 +02:00
|
|
|
|
2020-04-03 20:55:14 +02:00
|
|
|
let command = if let Some(args) = matches.values_of("exec") {
|
|
|
|
Some(CommandTemplate::new(args))
|
|
|
|
} else if let Some(args) = matches.values_of("exec-batch") {
|
|
|
|
Some(CommandTemplate::new_batch(args)?)
|
|
|
|
} else if matches.is_present("list-details") {
|
|
|
|
let color = matches.value_of("color").unwrap_or("auto");
|
2020-04-15 20:29:59 +02:00
|
|
|
#[allow(unused)]
|
2020-04-03 20:55:14 +02:00
|
|
|
let color_arg = ["--color=", color].concat();
|
2020-04-02 21:40:57 +02:00
|
|
|
|
2020-04-15 20:29:59 +02:00
|
|
|
let cmd: Vec<&str> = if cfg!(unix) {
|
|
|
|
if !cfg!(target_os = "macos") {
|
|
|
|
// Non-MacOS Unix
|
|
|
|
vec![
|
|
|
|
"ls",
|
|
|
|
"-l", // long listing format
|
|
|
|
"--human-readable", // human readable file sizes
|
|
|
|
"--directory", // list directories themselves, not their contents
|
|
|
|
&color_arg,
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
// MacOS
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
// Use GNU ls, if available
|
|
|
|
let gnu_ls_exists = Command::new("gls").arg("--version").status().is_ok();
|
|
|
|
|
|
|
|
if gnu_ls_exists {
|
|
|
|
vec![
|
|
|
|
"gls",
|
|
|
|
"-l", // long listing format
|
|
|
|
"--human-readable", // human readable file sizes
|
|
|
|
"--directory", // list directories themselves, not their contents
|
|
|
|
&color_arg,
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
let mut cmd = vec![
|
|
|
|
"ls", // MacOS version of ls
|
|
|
|
"-l", // long listing format
|
|
|
|
"-h", // '--human-readable' is not available on MacOS, '-h' is
|
|
|
|
"-d", // '--directory' is not available, but '-d' is
|
|
|
|
];
|
|
|
|
|
|
|
|
if colored_output {
|
|
|
|
cmd.push("-G");
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return Err(anyhow!(
|
|
|
|
"'fd --list-details' is not supported on this platform."
|
|
|
|
));
|
|
|
|
};
|
|
|
|
|
|
|
|
Some(CommandTemplate::new_batch(&cmd).unwrap())
|
2020-04-03 20:55:14 +02:00
|
|
|
} else {
|
|
|
|
None
|
|
|
|
};
|
2017-10-14 18:04:11 +02:00
|
|
|
|
2020-04-03 20:55:14 +02:00
|
|
|
let size_limits = if let Some(vs) = matches.values_of("size") {
|
|
|
|
vs.map(|sf| {
|
|
|
|
SizeFilter::from_string(sf).ok_or(anyhow!(
|
|
|
|
"'{}' is not a valid size constraint. See 'fd --help'.",
|
|
|
|
sf
|
|
|
|
))
|
2018-09-27 23:01:38 +02:00
|
|
|
})
|
2020-04-03 20:55:14 +02:00
|
|
|
.collect::<Result<Vec<_>>>()?
|
|
|
|
} else {
|
|
|
|
vec![]
|
|
|
|
};
|
2018-04-23 01:38:10 +02:00
|
|
|
|
2018-10-10 12:13:19 +02:00
|
|
|
let now = time::SystemTime::now();
|
|
|
|
let mut time_constraints: Vec<TimeFilter> = Vec::new();
|
2018-10-09 13:47:42 +02:00
|
|
|
if let Some(t) = matches.value_of("changed-within") {
|
2018-10-10 12:13:19 +02:00
|
|
|
if let Some(f) = TimeFilter::after(&now, t) {
|
|
|
|
time_constraints.push(f);
|
2018-10-09 13:47:42 +02:00
|
|
|
} else {
|
2020-04-03 20:55:14 +02:00
|
|
|
return Err(anyhow!(
|
|
|
|
"'{}' is not a valid date or duration. See 'fd --help'.",
|
|
|
|
t
|
|
|
|
));
|
2018-10-09 13:47:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if let Some(t) = matches.value_of("changed-before") {
|
2018-10-10 12:13:19 +02:00
|
|
|
if let Some(f) = TimeFilter::before(&now, t) {
|
|
|
|
time_constraints.push(f);
|
2018-10-09 13:47:42 +02:00
|
|
|
} else {
|
2020-04-03 20:55:14 +02:00
|
|
|
return Err(anyhow!(
|
|
|
|
"'{}' is not a valid date or duration. See 'fd --help'.",
|
|
|
|
t
|
|
|
|
));
|
2018-10-09 13:47:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-03 11:39:32 +02:00
|
|
|
let config = Options {
|
2017-10-14 18:04:11 +02:00
|
|
|
case_sensitive,
|
2017-10-12 08:01:51 +02:00
|
|
|
search_full_path: matches.is_present("full-path"),
|
2018-01-01 12:16:43 +01:00
|
|
|
ignore_hidden: !(matches.is_present("hidden")
|
|
|
|
|| matches.occurrences_of("rg-alias-hidden-ignore") >= 2),
|
2018-02-21 21:41:52 +01:00
|
|
|
read_fdignore: !(matches.is_present("no-ignore")
|
2018-01-01 12:16:43 +01:00
|
|
|
|| matches.is_present("rg-alias-hidden-ignore")),
|
2018-02-21 21:41:52 +01:00
|
|
|
read_vcsignore: !(matches.is_present("no-ignore")
|
2018-01-01 12:16:43 +01:00
|
|
|
|| matches.is_present("rg-alias-hidden-ignore")
|
|
|
|
|| matches.is_present("no-ignore-vcs")),
|
2017-10-12 08:01:51 +02:00
|
|
|
follow_links: matches.is_present("follow"),
|
2019-12-30 21:49:22 +01:00
|
|
|
one_file_system: matches.is_present("one-file-system"),
|
2017-10-12 08:01:51 +02:00
|
|
|
null_separator: matches.is_present("null_separator"),
|
2018-01-01 12:16:43 +01:00
|
|
|
max_depth: matches
|
2020-04-15 16:17:01 +02:00
|
|
|
.value_of("max-depth")
|
2018-09-13 18:19:17 +02:00
|
|
|
.or_else(|| matches.value_of("rg-depth"))
|
2020-04-15 16:17:01 +02:00
|
|
|
.or_else(|| matches.value_of("exact-depth"))
|
|
|
|
.and_then(|n| usize::from_str_radix(n, 10).ok()),
|
|
|
|
min_depth: matches
|
|
|
|
.value_of("min-depth")
|
|
|
|
.or_else(|| matches.value_of("exact-depth"))
|
2018-01-01 12:16:43 +01:00
|
|
|
.and_then(|n| usize::from_str_radix(n, 10).ok()),
|
2017-10-12 08:01:51 +02:00
|
|
|
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),
|
2017-10-14 18:04:11 +02:00
|
|
|
ls_colors,
|
2020-04-04 12:51:15 +02:00
|
|
|
interactive_terminal,
|
2018-02-25 11:11:14 +01:00
|
|
|
file_types: matches.values_of("file-type").map(|values| {
|
|
|
|
let mut file_types = FileTypes::default();
|
|
|
|
for value in values {
|
|
|
|
match value {
|
|
|
|
"f" | "file" => file_types.files = true,
|
|
|
|
"d" | "directory" => file_types.directories = true,
|
|
|
|
"l" | "symlink" => file_types.symlinks = true,
|
2018-03-25 12:19:51 +02:00
|
|
|
"x" | "executable" => {
|
|
|
|
file_types.executables_only = true;
|
|
|
|
file_types.files = true;
|
2018-03-25 16:36:37 +02:00
|
|
|
}
|
2018-08-19 17:05:04 +02:00
|
|
|
"e" | "empty" => {
|
|
|
|
file_types.empty_only = true;
|
|
|
|
}
|
2018-02-25 11:11:14 +01:00
|
|
|
_ => unreachable!(),
|
|
|
|
}
|
|
|
|
}
|
2018-08-19 17:05:04 +02:00
|
|
|
|
|
|
|
// If only 'empty' was specified, search for both files and directories:
|
|
|
|
if file_types.empty_only && !(file_types.files || file_types.directories) {
|
|
|
|
file_types.files = true;
|
|
|
|
file_types.directories = true;
|
|
|
|
}
|
|
|
|
|
2018-02-25 11:11:14 +01:00
|
|
|
file_types
|
|
|
|
}),
|
2020-04-03 20:55:14 +02:00
|
|
|
extensions: matches
|
|
|
|
.values_of("extension")
|
|
|
|
.map(|exts| {
|
|
|
|
let patterns = exts
|
|
|
|
.map(|e| e.trim_start_matches('.'))
|
|
|
|
.map(|e| format!(r".\.{}$", regex::escape(e)));
|
|
|
|
RegexSetBuilder::new(patterns)
|
|
|
|
.case_insensitive(true)
|
|
|
|
.build()
|
|
|
|
})
|
|
|
|
.transpose()?,
|
2019-01-29 23:09:45 +01:00
|
|
|
command: command.map(Arc::new),
|
2017-10-22 23:00:19 +02:00
|
|
|
exclude_patterns: matches
|
|
|
|
.values_of("exclude")
|
|
|
|
.map(|v| v.map(|p| String::from("!") + p).collect())
|
2017-10-26 21:13:56 +02:00
|
|
|
.unwrap_or_else(|| vec![]),
|
2018-03-26 00:15:01 +02:00
|
|
|
ignore_files: matches
|
|
|
|
.values_of("ignore-file")
|
|
|
|
.map(|vs| vs.map(PathBuf::from).collect())
|
|
|
|
.unwrap_or_else(|| vec![]),
|
2018-04-23 01:38:10 +02:00
|
|
|
size_constraints: size_limits,
|
2018-10-10 12:13:19 +02:00
|
|
|
time_constraints,
|
2018-10-22 14:20:08 +02:00
|
|
|
show_filesystem_errors: matches.is_present("show-errors"),
|
2019-04-11 00:30:56 +02:00
|
|
|
path_separator,
|
2020-04-02 17:52:44 +02:00
|
|
|
max_results: matches
|
|
|
|
.value_of("max-results")
|
|
|
|
.and_then(|n| usize::from_str_radix(n, 10).ok())
|
2020-04-09 17:21:40 +02:00
|
|
|
.filter(|&n| n != 0)
|
2020-04-15 15:47:17 +02:00
|
|
|
.or_else(|| {
|
|
|
|
if matches.is_present("max-one-result") {
|
|
|
|
Some(1)
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}),
|
2017-05-12 15:44:09 +02:00
|
|
|
};
|
2017-05-12 13:32:30 +02:00
|
|
|
|
2020-04-03 20:55:14 +02:00
|
|
|
let re = RegexBuilder::new(&pattern_regex)
|
2017-10-12 08:01:51 +02:00
|
|
|
.case_insensitive(!config.case_sensitive)
|
2017-10-14 15:41:38 +02:00
|
|
|
.dot_matches_new_line(true)
|
2018-01-01 12:16:43 +01:00
|
|
|
.build()
|
2020-04-03 20:55:14 +02:00
|
|
|
.map_err(|e| {
|
|
|
|
anyhow!(
|
|
|
|
"{}\n\nNote: You can use the '--fixed-strings' option to search for a \
|
|
|
|
literal string instead of a regular expression. Alternatively, you can \
|
|
|
|
also use the '--glob' option to match on a glob pattern.",
|
|
|
|
e.to_string()
|
|
|
|
)
|
|
|
|
})?;
|
|
|
|
|
2020-04-03 21:18:54 +02:00
|
|
|
walk::scan(&dir_vec, Arc::new(re), Arc::new(config))
|
2020-04-03 20:55:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let result = run();
|
|
|
|
match result {
|
|
|
|
Ok(exit_code) => {
|
2019-09-13 22:26:27 +02:00
|
|
|
process::exit(exit_code.into());
|
|
|
|
}
|
2018-10-03 15:53:59 +02:00
|
|
|
Err(err) => {
|
2020-04-03 20:55:14 +02:00
|
|
|
eprintln!("[fd error]: {}", err);
|
2020-04-03 21:34:59 +02:00
|
|
|
process::exit(ExitCode::GeneralError.into());
|
2018-10-03 15:53:59 +02:00
|
|
|
}
|
2017-05-12 11:50:03 +02:00
|
|
|
}
|
|
|
|
}
|