options.rs
This file
Path
src/options.rs
102 lines · 3.4 KiB · Rust
Last changed by
Add global fdignore supportBobbie Soedirgobefore adoption79d5a5b
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;8#[cfg(unix)]9use crate::filter::OwnerFilter;10use crate::filter::{SizeFilter, TimeFilter};1112/// Configuration options for *fd*.13pub struct Options {14 /// Whether the search is case-sensitive or case-insensitive.15 pub case_sensitive: bool,1617 /// Whether to search within the full file path or just the base name (filename or directory18 /// name).19 pub search_full_path: bool,2021 /// Whether to ignore hidden files and directories (or not).22 pub ignore_hidden: bool,2324 /// Whether to respect `.fdignore` files or not.25 pub read_fdignore: bool,2627 /// Whether to respect VCS ignore files (`.gitignore`, ..) or not.28 pub read_vcsignore: bool,2930 /// Whether to respect the global ignore file or not.31 pub read_global_ignore: bool,3233 /// Whether to follow symlinks or not.34 pub follow_links: bool,3536 /// Whether to limit the search to starting file system or not.37 pub one_file_system: bool,3839 /// Whether elements of output should be separated by a null character40 pub null_separator: bool,4142 /// The maximum search depth, or `None` if no maximum search depth should be set.43 ///44 /// A depth of `1` includes all files under the current directory, a depth of `2` also includes45 /// all files under subdirectories of the current directory, etc.46 pub max_depth: Option<usize>,4748 /// The minimum depth for reported entries, or `None`.49 pub min_depth: Option<usize>,5051 /// The number of threads to use.52 pub threads: usize,5354 /// Time to buffer results internally before streaming to the console. This is useful to55 /// provide a sorted output, in case the total execution time is shorter than56 /// `max_buffer_time`.57 pub max_buffer_time: Option<Duration>,5859 /// `None` if the output should not be colorized. Otherwise, a `LsColors` instance that defines60 /// how to style different filetypes.61 pub ls_colors: Option<LsColors>,6263 /// Whether or not we are writing to an interactive terminal64 pub interactive_terminal: bool,6566 /// The type of file to search for. If set to `None`, all file types are displayed. If67 /// set to `Some(..)`, only the types that are specified are shown.68 pub file_types: Option<FileTypes>,6970 /// The extension to search for. Only entries matching the extension will be included.71 ///72 /// The value (if present) will be a lowercase string without leading dots.73 pub extensions: Option<RegexSet>,7475 /// If a value is supplied, each item found will be used to generate and execute commands.76 pub command: Option<Arc<CommandTemplate>>,7778 /// A list of glob patterns that should be excluded from the search.79 pub exclude_patterns: Vec<String>,8081 /// A list of custom ignore files.82 pub ignore_files: Vec<PathBuf>,8384 /// The given constraints on the size of returned files85 pub size_constraints: Vec<SizeFilter>,8687 /// Constraints on last modification time of files88 pub time_constraints: Vec<TimeFilter>,8990 #[cfg(unix)]91 /// User/group ownership constraint92 pub owner_constraint: Option<OwnerFilter>,9394 /// Whether or not to display filesystem errors95 pub show_filesystem_errors: bool,9697 /// The separator used to print file paths.98 pub path_separator: Option<String>,99100 /// The maximum number of search results101 pub max_results: Option<usize>,102}