"Fossies" - the Fresh Open Source Software Archive

Member "fd-8.1.1/src/options.rs" (25 May 2020, 3523 Bytes) of package /linux/privat/fd-8.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Rust source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "options.rs": 8.0.0_vs_8.1.0.

    1 use std::{path::PathBuf, sync::Arc, time::Duration};
    2 
    3 use lscolors::LsColors;
    4 use regex::bytes::RegexSet;
    5 
    6 use crate::exec::CommandTemplate;
    7 use crate::filetypes::FileTypes;
    8 #[cfg(unix)]
    9 use crate::filter::OwnerFilter;
   10 use crate::filter::{SizeFilter, TimeFilter};
   11 
   12 /// Configuration options for *fd*.
   13 pub struct Options {
   14     /// Whether the search is case-sensitive or case-insensitive.
   15     pub case_sensitive: bool,
   16 
   17     /// Whether to search within the full file path or just the base name (filename or directory
   18     /// name).
   19     pub search_full_path: bool,
   20 
   21     /// Whether to ignore hidden files and directories (or not).
   22     pub ignore_hidden: bool,
   23 
   24     /// Whether to respect `.fdignore` files or not.
   25     pub read_fdignore: bool,
   26 
   27     /// Whether to respect VCS ignore files (`.gitignore`, ..) or not.
   28     pub read_vcsignore: bool,
   29 
   30     /// Whether to respect the global ignore file or not.
   31     pub read_global_ignore: bool,
   32 
   33     /// Whether to follow symlinks or not.
   34     pub follow_links: bool,
   35 
   36     /// Whether to limit the search to starting file system or not.
   37     pub one_file_system: bool,
   38 
   39     /// Whether elements of output should be separated by a null character
   40     pub null_separator: bool,
   41 
   42     /// 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 includes
   45     /// all files under subdirectories of the current directory, etc.
   46     pub max_depth: Option<usize>,
   47 
   48     /// The minimum depth for reported entries, or `None`.
   49     pub min_depth: Option<usize>,
   50 
   51     /// The number of threads to use.
   52     pub threads: usize,
   53 
   54     /// Time to buffer results internally before streaming to the console. This is useful to
   55     /// provide a sorted output, in case the total execution time is shorter than
   56     /// `max_buffer_time`.
   57     pub max_buffer_time: Option<Duration>,
   58 
   59     /// `None` if the output should not be colorized. Otherwise, a `LsColors` instance that defines
   60     /// how to style different filetypes.
   61     pub ls_colors: Option<LsColors>,
   62 
   63     /// Whether or not we are writing to an interactive terminal
   64     pub interactive_terminal: bool,
   65 
   66     /// The type of file to search for. If set to `None`, all file types are displayed. If
   67     /// set to `Some(..)`, only the types that are specified are shown.
   68     pub file_types: Option<FileTypes>,
   69 
   70     /// 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>,
   74 
   75     /// If a value is supplied, each item found will be used to generate and execute commands.
   76     pub command: Option<Arc<CommandTemplate>>,
   77 
   78     /// A list of glob patterns that should be excluded from the search.
   79     pub exclude_patterns: Vec<String>,
   80 
   81     /// A list of custom ignore files.
   82     pub ignore_files: Vec<PathBuf>,
   83 
   84     /// The given constraints on the size of returned files
   85     pub size_constraints: Vec<SizeFilter>,
   86 
   87     /// Constraints on last modification time of files
   88     pub time_constraints: Vec<TimeFilter>,
   89 
   90     #[cfg(unix)]
   91     /// User/group ownership constraint
   92     pub owner_constraint: Option<OwnerFilter>,
   93 
   94     /// Whether or not to display filesystem errors
   95     pub show_filesystem_errors: bool,
   96 
   97     /// The separator used to print file paths.
   98     pub path_separator: Option<String>,
   99 
  100     /// The maximum number of search results
  101     pub max_results: Option<usize>,
  102 }