options.rs
This file
Path
src/options.rs
93 lines · 3.2 KiB · Rust
Last changed by
Add --min-depth and --exact-depthsharkdpbefore adoptiond63c63b
History of this fileTake it
1use std::{path::PathBuf, sync::Arc, time::Duration};23use lscolors::LsColors;4use regex::bytes::RegexSet;56use crate::exec::CommandTemplate;7use crate::filetypes::FileTypes;8use crate::filter::{SizeFilter, TimeFilter};910/// Configuration options for *fd*.11pub struct Options {12 /// Whether the search is case-sensitive or case-insensitive.13 pub case_sensitive: bool,1415 /// Whether to search within the full file path or just the base name (filename or directory16 /// name).17 pub search_full_path: bool,1819 /// Whether to ignore hidden files and directories (or not).20 pub ignore_hidden: bool,2122 /// Whether to respect `.fdignore` files or not.23 pub read_fdignore: bool,2425 /// Whether to respect VCS ignore files (`.gitignore`, ..) or not.26 pub read_vcsignore: bool,2728 /// Whether to follow symlinks or not.29 pub follow_links: bool,3031 /// Whether to limit the search to starting file system or not.32 pub one_file_system: bool,3334 /// Whether elements of output should be separated by a null character35 pub null_separator: bool,3637 /// The maximum search depth, or `None` if no maximum search depth should be set.38 ///39 /// A depth of `1` includes all files under the current directory, a depth of `2` also includes40 /// all files under subdirectories of the current directory, etc.41 pub max_depth: Option<usize>,4243 /// The minimum depth for reported entries, or `None`.44 pub min_depth: Option<usize>,4546 /// The number of threads to use.47 pub threads: usize,4849 /// Time to buffer results internally before streaming to the console. This is useful to50 /// provide a sorted output, in case the total execution time is shorter than51 /// `max_buffer_time`.52 pub max_buffer_time: Option<Duration>,5354 /// `None` if the output should not be colorized. Otherwise, a `LsColors` instance that defines55 /// how to style different filetypes.56 pub ls_colors: Option<LsColors>,5758 /// Whether or not we are writing to an interactive terminal59 pub interactive_terminal: bool,6061 /// The type of file to search for. If set to `None`, all file types are displayed. If62 /// set to `Some(..)`, only the types that are specified are shown.63 pub file_types: Option<FileTypes>,6465 /// The extension to search for. Only entries matching the extension will be included.66 ///67 /// The value (if present) will be a lowercase string without leading dots.68 pub extensions: Option<RegexSet>,6970 /// If a value is supplied, each item found will be used to generate and execute commands.71 pub command: Option<Arc<CommandTemplate>>,7273 /// A list of glob patterns that should be excluded from the search.74 pub exclude_patterns: Vec<String>,7576 /// A list of custom ignore files.77 pub ignore_files: Vec<PathBuf>,7879 /// The given constraints on the size of returned files80 pub size_constraints: Vec<SizeFilter>,8182 /// Constraints on last modification time of files83 pub time_constraints: Vec<TimeFilter>,8485 /// Whether or not to display filesystem errors86 pub show_filesystem_errors: bool,8788 /// The separator used to print file paths.89 pub path_separator: Option<String>,9091 /// The maximum number of search results92 pub max_results: Option<usize>,93}