Skip to content
Myr

main.rs

This file

Path

src/main.rs

399 lines · 13.6 KiB · Rust

Last changed by

Add new `--type socket` and `--type pipe` filterssharkdpbefore adoptioncb56add

History of this file

Take it

The walk stopped after 200 commits: lines older than 45d1b15 point at it.

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 1why, one step back
1mod app;

Clean up include ordersharkdpbefore adoption53557ef

line 2why, one step back
2mod error;

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 3–4why, one step back
3mod exec;
4mod exit_codes;

Rename fshelper to filesystemsharkdpbefore adoptionb415d72

line 5why, one step back
5mod filesystem;

Move filetypes up from 'internal'sharkdpbefore adoption5c27ab1

line 6why, one step back
6mod filetypes;

Move filter up from internalsharkdpbefore adoption9f738ad

line 7why, one step back
7mod filter;

Move FdOptions to Optionssharkdpbefore adoption65096a6

line 8why, one step back
8mod options;

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 9why, one step back
9mod output;

Move regex helpers to new modulesharkdpbefore adoption809fd8f

line 10why, one step back
10mod regex_helper;

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 11–14why, one step back
11mod walk;
1213use std::env;14use std::path::{Path, PathBuf};

Expose exit status from `--exec-batch <cmd>`sharkdpbefore adoptiona0505bd

line 15why, one step back
15use std::process;

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 16–18why, one step back
16use std::sync::Arc;
17use std::time;18

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 19why, one step back
19use anyhow::{anyhow, Context, Result};

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 20why, one step back
20use atty::Stream;

--glob: '*' does not match on path separatorssharkdpbefore adoption47974b6

line 21why, one step back
21use globset::GlobBuilder;

Use lscolors cratesharkdpbefore adoption4b5efa3

line 22why, one step back
22use lscolors::LsColors;

Use regex::bytes::* instead of regex::*sharkdpbefore adoption641594c

line 23why, one step back
23use regex::bytes::{RegexBuilder, RegexSetBuilder};

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 24why, one step back
24

[2018 edition] run cargo fix edition and edition-idiomsAlexandru Macoveibefore adoption64e6ea9

line 25why, one step back
25use crate::exec::CommandTemplate;

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 26why, one step back
26use crate::exit_codes::ExitCode;

Move filetypes up from 'internal'sharkdpbefore adoption5c27ab1

line 27why, one step back
27use crate::filetypes::FileTypes;

Move filter up from internalsharkdpbefore adoption9f738ad

line 28why, one step back
28use crate::filter::{SizeFilter, TimeFilter};

Move FdOptions to Optionssharkdpbefore adoption65096a6

line 29why, one step back
29use crate::options::Options;

Move regex helpers to new modulesharkdpbefore adoption809fd8f

line 30why, one step back
30use crate::regex_helper::pattern_has_uppercase_char;

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 31why, one step back
31

Disable jemallocator on Windowssharkdpbefore adoption4e20803

line 32why, one step back
32// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481

Clean up cfg linesharkdpbefore adoption9350c85

line 33why, one step back
33#[cfg(all(not(windows), not(target_env = "musl")))]

Use jemallocsharkdpbefore adoption5a15486

lines 34–36why, one step back
34#[global_allocator]
35static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;36

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 37why, one step back
37fn run() -> Result<ExitCode> {

Remove possibility to use '--exec <cmd>' with a single dashsharkdpbefore adoption342d12d

line 38why, one step back
38 let matches = app::build_app().get_matches_from(env::args_os());

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 39why, one step back
39

Allow changing current working directory of fdRafał Hajdackibefore adoptionfb205f5

line 40why, one step back
40 // Set the current working directory of the process

Reimplement dirname, basename, remove_extension for OsStrsharkdpbefore adoption7e3c69c

line 41why, one step back
41 if let Some(base_directory) = matches.value_of_os("base-directory") {

Refactor directory handlingsharkdpbefore adoption094516a

lines 42–43why, one step back
42 let base_directory = Path::new(base_directory);
43 if !filesystem::is_dir(base_directory) {

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 44–45why, one step back
44 return Err(anyhow!(
45 "The '--base-directory' path '{}' is not a directory.",

Refactor directory handlingsharkdpbefore adoption094516a

line 46why, one step back
46 base_directory.to_string_lossy()

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 47why, one step back
47 ));

Allow changing current working directory of fdRafał Hajdackibefore adoptionfb205f5

line 48why, one step back
48 }

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 49–54why, one step back
49 env::set_current_dir(base_directory).with_context(|| {
50 format!(51 "Could not set '{}' as the current working directory.",52 base_directory.to_string_lossy()53 )54 })?;

Allow changing current working directory of fdRafał Hajdackibefore adoptionfb205f5

lines 55–56why, one step back
55 }
56

Refactor directory handlingsharkdpbefore adoption094516a

lines 57–58why, one step back
57 let current_directory = Path::new(".");
58 if !filesystem::is_dir(current_directory) {

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 59–61why, one step back
59 return Err(anyhow!(
60 "Could not retrieve current directory (has it been deleted?)."61 ));

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 62–63why, one step back
62 }
63

Refactor directory handlingsharkdpbefore adoption094516a

line 64why, one step back
64 // Get the search pattern

Reimplement dirname, basename, remove_extension for OsStrsharkdpbefore adoption7e3c69c

lines 65–73why, one step back
65 let pattern = matches
66 .value_of_os("pattern")67 .map(|p| {68 p.to_str().ok_or(anyhow!(69 "The search pattern includes invalid UTF-8 sequences."70 ))71 })72 .transpose()?73 .unwrap_or("");

Refactor directory handlingsharkdpbefore adoption094516a

line 74why, one step back
74

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 75–76why, one step back
75 // Get one or more root directories to search.
76 let mut dir_vec: Vec<_> = match matches

Reimplement dirname, basename, remove_extension for OsStrsharkdpbefore adoption7e3c69c

lines 77–78why, one step back
77 .values_of_os("path")
78 .or_else(|| matches.values_of_os("search-path"))

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 79–82why, one step back
79 {
80 Some(paths) => paths81 .map(|path| {82 let path_buffer = PathBuf::from(path);

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 83–87why, one step back
83 if filesystem::is_dir(&path_buffer) {
84 Ok(path_buffer)85 } else {86 Err(anyhow!(87 "Search path '{}' is not a directory.",

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 88why, one step back
88 path_buffer.to_string_lossy()

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 89why, one step back
89 ))

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 90–91why, one step back
90 }
91 })

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 92why, one step back
92 .collect::<Result<Vec<_>>>()?,

Refactor directory handlingsharkdpbefore adoption094516a

line 93why, one step back
93 None => vec![current_directory.to_path_buf()],

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 94–101why, one step back
94 };
9596 if matches.is_present("absolute-path") {97 dir_vec = dir_vec98 .iter()99 .map(|path_buffer| {100 path_buffer101 .canonicalize()

Rename fshelper to filesystemsharkdpbefore adoptionb415d72

line 102why, one step back
102 .and_then(|pb| filesystem::absolute_path(pb.as_path()))

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 103–110why, one step back
103 .unwrap()
104 })105 .collect();106 }107108 // Detect if the user accidentally supplied a path instead of a search pattern109 if !matches.is_present("full-path")110 && pattern.contains(std::path::MAIN_SEPARATOR)

Rename fshelper to filesystemsharkdpbefore adoptionb415d72

line 111why, one step back
111 && filesystem::is_dir(Path::new(pattern))

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 112why, one step back
112 {

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 113why, one step back
113 return Err(anyhow!(

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 114–117why, one step back
114 "The search pattern '{pattern}' contains a path-separation character ('{sep}') \
115 and will not lead to any search results.\n\n\116 If you want to search for all files inside the '{pattern}' directory, use a match-all pattern:\n\n \117 fd . '{pattern}'\n\n\

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 118why, one step back
118 Instead, if you want your pattern to match the full file path, use:\n\n \

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 119–121why, one step back
119 fd --full-path '{pattern}'",
120 pattern = pattern,121 sep = std::path::MAIN_SEPARATOR,

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 122why, one step back
122 ));

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 123–124why, one step back
123 }
124

Implement glob-based searchessharkdpbefore adoptiond5da615

line 125why, one step back
125 let pattern_regex = if matches.is_present("glob") {

--glob: '*' does not match on path separatorssharkdpbefore adoption47974b6

line 126why, one step back
126 let glob = GlobBuilder::new(pattern).literal_separator(true).build()?;

Implement glob-based searchessharkdpbefore adoptiond5da615

lines 127–129why, one step back
127 glob.regex().to_owned()
128 } else if matches.is_present("fixed-strings") {129 // Treat pattern as literal string if '--fixed-strings' is used

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 130–139why, one step back
130 regex::escape(pattern)
131 } else {132 String::from(pattern)133 };134135 // The search will be case-sensitive if the command line flag is set or136 // if the pattern has an uppercase character (smart case).137 let case_sensitive = !matches.is_present("ignore-case")138 && (matches.is_present("case-sensitive") || pattern_has_uppercase_char(&pattern_regex));139

Print path as raw bytes, allowing invalid UTF-8 filenames to be passed to other processessharkdpbefore adoption6c9e743

line 140why, one step back
140 let interactive_terminal = atty::is(Stream::Stdout);

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 141–143why, one step back
141 let colored_output = match matches.value_of("color") {
142 Some("always") => true,143 Some("never") => false,

Print path as raw bytes, allowing invalid UTF-8 filenames to be passed to other processessharkdpbefore adoption6c9e743

line 144why, one step back
144 _ => env::var_os("NO_COLOR").is_none() && interactive_terminal,

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 145–146why, one step back
145 };
146

Remove type annotation.Nathan Moreaubefore adoption588e344

line 147why, one step back
147 let path_separator = matches.value_of("path-separator").map(|str| str.to_owned());

Add path-separator option.Nathan Moreaubefore adoption24e108e

line 148why, one step back
148

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 149why, one step back
149 #[cfg(windows)]

Always enable colors on Windows, closes #469sharkdpbefore adoption3b42898

line 150why, one step back
150 ansi_term::enable_ansi_support().ok();

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 151–152why, one step back
151
152 let ls_colors = if colored_output {

Use lscolors cratesharkdpbefore adoption4b5efa3

line 153why, one step back
153 Some(LsColors::from_env().unwrap_or_default())

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 154–157why, one step back
154 } else {
155 None156 };157

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 158–164why, one step back
158 let command = if let Some(args) = matches.values_of("exec") {
159 Some(CommandTemplate::new(args))160 } else if let Some(args) = matches.values_of("exec-batch") {161 Some(CommandTemplate::new_batch(args)?)162 } else if matches.is_present("list-details") {163 let color = matches.value_of("color").unwrap_or("auto");164 let color_arg = ["--color=", color].concat();

Add `-l`/`--list` optionsharkdpbefore adoptionda5cd12

line 165why, one step back
165

Add testsharkdpbefore adoption4287cdd

line 166why, one step back
166 #[allow(unused)]

Windows support (if GNU ls is installed)sharkdpbefore adoption0b7febc

lines 167–176why, one step back
167 let gnu_ls = |command_name| {
168 vec![169 command_name,170 "-l", // long listing format171 "--human-readable", // human readable file sizes172 "--directory", // list directories themselves, not their contents173 &color_arg,174 ]175 };176

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

lines 177–179why, one step back
177 let cmd: Vec<&str> = if cfg!(unix) {
178 if !cfg!(target_os = "macos") {179 // Non-MacOS Unix

Windows support (if GNU ls is installed)sharkdpbefore adoption0b7febc

line 180why, one step back
180 gnu_ls("ls")

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

lines 181–182why, one step back
181 } else {
182 // MacOS

Do not show output of 'gls --version'sharkdpbefore adoption0f5500a

line 183why, one step back
183 use std::process::{Command, Stdio};

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

line 184why, one step back
184

Add comment why we prefer glssharkdpbefore adoptiond91100e

line 185why, one step back
185 // Use GNU ls, if available (support for --color=auto, better LS_COLORS support)

Do not show output of 'gls --version'sharkdpbefore adoption0f5500a

lines 186–191why, one step back
186 let gnu_ls_exists = Command::new("gls")
187 .arg("--version")188 .stdout(Stdio::null())189 .stderr(Stdio::null())190 .status()191 .is_ok();

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

lines 192–193why, one step back
192
193 if gnu_ls_exists {

Windows support (if GNU ls is installed)sharkdpbefore adoption0b7febc

line 194why, one step back
194 gnu_ls("gls")

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

lines 195–209why, one step back
195 } else {
196 let mut cmd = vec![197 "ls", // MacOS version of ls198 "-l", // long listing format199 "-h", // '--human-readable' is not available on MacOS, '-h' is200 "-d", // '--directory' is not available, but '-d' is201 ];202203 if colored_output {204 cmd.push("-G");205 }206207 cmd208 }209 }

Windows support (if GNU ls is installed)sharkdpbefore adoption0b7febc

lines 210–224why, one step back
210 } else if cfg!(windows) {
211 use std::process::{Command, Stdio};212213 // Use GNU ls, if available214 let gnu_ls_exists = Command::new("ls")215 .arg("--version")216 .stdout(Stdio::null())217 .stderr(Stdio::null())218 .status()219 .is_ok();220221 if gnu_ls_exists {222 gnu_ls("ls")223 } else {224 return Err(anyhow!(

Add testsharkdpbefore adoption4287cdd

line 225why, one step back
225 "'fd --list-details' is not supported on Windows unless GNU 'ls' is installed."

Windows support (if GNU ls is installed)sharkdpbefore adoption0b7febc

lines 226–227why, one step back
226 ));
227 }

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

lines 228–229why, one step back
228 } else {
229 return Err(anyhow!(

Add testsharkdpbefore adoption4287cdd

line 230why, one step back
230 "'fd --list-details' is not supported on this platform."

Add MacOS support for -l/--list-detailssharkdpbefore adoption2685728

lines 231–234why, one step back
231 ));
232 };233234 Some(CommandTemplate::new_batch(&cmd).unwrap())

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 235–237why, one step back
235 } else {
236 None237 };

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 238why, one step back
238

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 239–244why, one step back
239 let size_limits = if let Some(vs) = matches.values_of("size") {
240 vs.map(|sf| {241 SizeFilter::from_string(sf).ok_or(anyhow!(242 "'{}' is not a valid size constraint. See 'fd --help'.",243 sf244 ))

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 245why, one step back
245 })

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 246–249why, one step back
246 .collect::<Result<Vec<_>>>()?
247 } else {248 vec![]249 };

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 250–256why, one step back
250
251 let now = time::SystemTime::now();252 let mut time_constraints: Vec<TimeFilter> = Vec::new();253 if let Some(t) = matches.value_of("changed-within") {254 if let Some(f) = TimeFilter::after(&now, t) {255 time_constraints.push(f);256 } else {

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 257–260why, one step back
257 return Err(anyhow!(
258 "'{}' is not a valid date or duration. See 'fd --help'.",259 t260 ));

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 261–266why, one step back
261 }
262 }263 if let Some(t) = matches.value_of("changed-before") {264 if let Some(f) = TimeFilter::before(&now, t) {265 time_constraints.push(f);266 } else {

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 267–270why, one step back
267 return Err(anyhow!(
268 "'{}' is not a valid date or duration. See 'fd --help'.",269 t270 ));

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 271–273why, one step back
271 }
272 }273

Move FdOptions to Optionssharkdpbefore adoption65096a6

line 274why, one step back
274 let config = Options {

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 275–284why, one step back
275 case_sensitive,
276 search_full_path: matches.is_present("full-path"),277 ignore_hidden: !(matches.is_present("hidden")278 || matches.occurrences_of("rg-alias-hidden-ignore") >= 2),279 read_fdignore: !(matches.is_present("no-ignore")280 || matches.is_present("rg-alias-hidden-ignore")),281 read_vcsignore: !(matches.is_present("no-ignore")282 || matches.is_present("rg-alias-hidden-ignore")283 || matches.is_present("no-ignore-vcs")),284 follow_links: matches.is_present("follow"),

Rename `--same-file-system` to `--one-file-system`Simon Engmannbefore adoption94993ca

line 285why, one step back
285 one_file_system: matches.is_present("one-file-system"),

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 286–287why, one step back
286 null_separator: matches.is_present("null_separator"),
287 max_depth: matches

Add --min-depth and --exact-depthsharkdpbefore adoptiond63c63b

line 288why, one step back
288 .value_of("max-depth")

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 289why, one step back
289 .or_else(|| matches.value_of("rg-depth"))

Add --min-depth and --exact-depthsharkdpbefore adoptiond63c63b

lines 290–294why, one step back
290 .or_else(|| matches.value_of("exact-depth"))
291 .and_then(|n| usize::from_str_radix(n, 10).ok()),292 min_depth: matches293 .value_of("min-depth")294 .or_else(|| matches.value_of("exact-depth"))

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 295–307why, one step back
295 .and_then(|n| usize::from_str_radix(n, 10).ok()),
296 threads: std::cmp::max(297 matches298 .value_of("threads")299 .and_then(|n| usize::from_str_radix(n, 10).ok())300 .unwrap_or_else(num_cpus::get),301 1,302 ),303 max_buffer_time: matches304 .value_of("max-buffer-time")305 .and_then(|n| u64::from_str_radix(n, 10).ok())306 .map(time::Duration::from_millis),307 ls_colors,

Print path as raw bytes, allowing invalid UTF-8 filenames to be passed to other processessharkdpbefore adoption6c9e743

line 308why, one step back
308 interactive_terminal,

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 309–319why, one step back
309 file_types: matches.values_of("file-type").map(|values| {
310 let mut file_types = FileTypes::default();311 for value in values {312 match value {313 "f" | "file" => file_types.files = true,314 "d" | "directory" => file_types.directories = true,315 "l" | "symlink" => file_types.symlinks = true,316 "x" | "executable" => {317 file_types.executables_only = true;318 file_types.files = true;319 }

Add new `--type socket` and `--type pipe` filterssharkdpbefore adoptioncb56add

lines 320–322why, one step back
320 "e" | "empty" => file_types.empty_only = true,
321 "s" | "socket" => file_types.sockets = true,322 "p" | "pipe" => file_types.pipes = true,

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 323–334why, one step back
323 _ => unreachable!(),
324 }325 }326327 // If only 'empty' was specified, search for both files and directories:328 if file_types.empty_only && !(file_types.files || file_types.directories) {329 file_types.files = true;330 file_types.directories = true;331 }332333 file_types334 }),

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 335–345why, one step back
335 extensions: matches
336 .values_of("extension")337 .map(|exts| {338 let patterns = exts339 .map(|e| e.trim_start_matches('.'))340 .map(|e| format!(r".\.{}$", regex::escape(e)));341 RegexSetBuilder::new(patterns)342 .case_insensitive(true)343 .build()344 })345 .transpose()?,

avoid cloning command, in the wake of 9d26b74Alexandru Macoveibefore adoptionc2b46f2

line 346why, one step back
346 command: command.map(Arc::new),

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 347–357why, one step back
347 exclude_patterns: matches
348 .values_of("exclude")349 .map(|v| v.map(|p| String::from("!") + p).collect())350 .unwrap_or_else(|| vec![]),351 ignore_files: matches352 .values_of("ignore-file")353 .map(|vs| vs.map(PathBuf::from).collect())354 .unwrap_or_else(|| vec![]),355 size_constraints: size_limits,356 time_constraints,357 show_filesystem_errors: matches.is_present("show-errors"),

Add path-separator option.Nathan Moreaubefore adoption24e108e

line 358why, one step back
358 path_separator,

Add --max-results=<count> optionsharkdpbefore adoptiond43827f

lines 359–361why, one step back
359 max_results: matches
360 .value_of("max-results")361 .and_then(|n| usize::from_str_radix(n, 10).ok())

Add alias -1 for --max-results=1Danny Möschbefore adoption2bab4a2

line 362why, one step back
362 .filter(|&n| n != 0)

--glob: '*' does not match on path separatorssharkdpbefore adoption47974b6

lines 363–369why, one step back
363 .or_else(|| {
364 if matches.is_present("max-one-result") {365 Some(1)366 } else {367 None368 }369 }),

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 370–371why, one step back
370 };
371

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 372why, one step back
372 let re = RegexBuilder::new(&pattern_regex)

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 373–375why, one step back
373 .case_insensitive(!config.case_sensitive)
374 .dot_matches_new_line(true)375 .build()

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 376–384why, one step back
376 .map_err(|e| {
377 anyhow!(378 "{}\n\nNote: You can use the '--fixed-strings' option to search for a \379 literal string instead of a regular expression. Alternatively, you can \380 also use the '--glob' option to match on a glob pattern.",381 e.to_string()382 )383 })?;384

Proper error handling within walk.rssharkdpbefore adoption4590ae8

line 385why, one step back
385 walk::scan(&dir_vec, Arc::new(re), Arc::new(config))

Proper error handling in main.rssharkdpbefore adoptionbce9527

lines 386–391why, one step back
386}
387388fn main() {389 let result = run();390 match result {391 Ok(exit_code) => {

Expose exit status from `--exec-batch <cmd>`sharkdpbefore adoptiona0505bd

lines 392–393why, one step back
392 process::exit(exit_code.into());
393 }

Add support for batch execution of commandkimsnjbefore adoption45d1b15

line 394why, one step back
394 Err(err) => {

Proper error handling in main.rssharkdpbefore adoptionbce9527

line 395why, one step back
395 eprintln!("[fd error]: {}", err);

Remove process::exit instancesharkdpbefore adoption4815ee4

line 396why, one step back
396 process::exit(ExitCode::GeneralError.into());

Add support for batch execution of commandkimsnjbefore adoption45d1b15

lines 397–399why, one step back
397 }
398 }399}