Skip to content
Myr

Make help output more like what it was before use clap_derive

Before adoption: this commit came in with the history the project adopted, so no landing records it.

In particular, we specifically use `long_help` instead of doc comments because using doc comments will always trim the "." off the end of the first paragraph, and will include the short help as the first paragraph of the full help.

authored by Thayne McCombs · committed by Thayne McCombs · parent 8500c31 · Browse files · 1 file+317 added−236 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+317 added−236 removed

  • other:+317 added−236 removed

1 file+317 added−236 removed

modified:src/cli.rs+317 added-236 removed
82 unmodified lines
8384#[derive(Parser)]85#[command(86 version,87 after_help = "Note: `fd -h` prints a short and concise overview while `fd --help` gives all \88 details.",87 after_long_help = "Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues",88 args_override_self = true,89 group(ArgGroup::new("execs").args(&["exec", "exec_batch", "list_details"]).conflicts_with_all(&[90 "max_results", "has_results", "count"])),91)]92pub struct Opts {93 /// Search hidden files and directories96 ///97 /// Include hidden directories and files in the search results (default:98 /// hidden files and directories are skipped). Files and directories are considered99 /// to be hidden if their name starts with a `.` sign (dot).100 /// The flag can be overridden with --no-hidden.101 #[arg(long, short = 'H')]94 #[arg(95 long,96 short = 'H',97 long_help = "Include hidden directories and files in the search results (default: \98 hidden files and directories are skipped). Files and directories are \99 considered to be hidden if their name starts with a `.` sign (dot). \100 The flag can be overridden with --no-hidden."101 )]102 pub hidden: bool,103 /// Do not respect .(git|fd)ignore files104 ///105 /// Show search results from files and directories that would otherwise be106 /// ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.107 /// The flag can be overridden with --ignore.108 #[arg(long, short = 'I')]104 #[arg(105 long,106 short = 'I',107 long_help = "Show search results from files and directories that would otherwise be \108 ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file. \109 The flag can be overridden with --ignore."110 )]111 pub no_ignore: bool,112 /// Do not respect .gitignore files111 ///112 ///Show search results from files and directories that would otherwise be113 ///ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs.114 #[arg(long, hide_short_help = true)]113 #[arg(114 long,115 hide_short_help = true,116 long_help = "Show search results from files and directories that would otherwise be \117 ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs."118 )]119 pub no_ignore_vcs: bool,120 /// Do not respect .(git|fd)ignore files in parent directories117 ///118 /// Show search results from files and directories that would otherwise be119 /// ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories.120 #[arg(long, hide_short_help = true)]121 #[arg(122 long,123 hide_short_help = true,124 long_help = "Show search results from files and directories that would otherwise be \125 ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories."126 )]127 pub no_ignore_parent: bool,128 /// Do not respect the global ignore file129 #[arg(long, hide = true)]130 pub no_global_ignore_file: bool,125 ///Perform an unrestricted search, including ignored and hidden files. This is126 ///an alias for '--no-ignore --hidden'.127 #[arg(long = "unrestricted", short = 'u', overrides_with_all(&["ignore", "no_hidden"]), action(ArgAction::Count), hide_short_help = true)]131 /// Unrestricted search, alias for '--no-ignore --hidden'132 #[arg(long = "unrestricted", short = 'u', overrides_with_all(&["ignore", "no_hidden"]), action(ArgAction::Count), hide_short_help = true,133 long_help = "Perform an unrestricted search, including ignored and hidden files. This is \134 an alias for '--no-ignore --hidden'."135 )]136 rg_alias_hidden_ignore: u8,137 /// Case-sensitive search (default: smart case)130 ///131 ///Perform a case-sensitive search. By default, fd uses case-insensitive132 ///searches, unless the pattern contains an uppercase character (smart case).133 #[arg(long, short = 's', overrides_with("ignore_case"))]138 #[arg(139 long,140 short = 's',141 overrides_with("ignore_case"),142 long_help = "Perform a case-sensitive search. By default, fd uses case-insensitive \143 searches, unless the pattern contains an uppercase character (smart \144 case)."145 )]146 pub case_sensitive: bool,147 /// Case-insensitive search (default: smart case)136 ///137 /// Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless138 /// the pattern contains an uppercase character (smart case).139 #[arg(long, short = 'i', overrides_with("case_sensitive"))]148 #[arg(149 long,150 short = 'i',151 overrides_with("case_sensitive"),152 long_help = "Perform a case-insensitive search. By default, fd uses case-insensitive \153 searches, unless the pattern contains an uppercase character (smart \154 case)."155 )]156 pub ignore_case: bool,157 /// Glob-based search (default: regular expression)142 ///143 /// Perform a glob-based search instead of a regular expression search.144 #[arg(long, short = 'g', conflicts_with("fixed_strings"))]158 #[arg(159 long,160 short = 'g',161 conflicts_with("fixed_strings"),162 long_help = "Perform a glob-based search instead of a regular expression search."163 )]164 pub glob: bool,146 /// Perform a regular-expression based search (default). This can be used to override --glob.147 #[arg(long, overrides_with("glob"), hide_short_help = true)]165 /// Regular-expression based search (default)166 #[arg(167 long,168 overrides_with("glob"),169 hide_short_help = true,170 long_help = "Perform a regular-expression based search (default). This can be used to \171 override --glob."172 )]173 pub regex: bool,149 /// Treat the pattern as a literal string instead of a regular expression. Note150 /// that this also performs substring comparison. If you want to match on an151 /// exact filename, consider using '--glob'.152 #[arg(long, short = 'F', alias = "literal", hide_short_help = true)]174 /// Treat pattern as literal string stead of regex175 #[arg(176 long,177 short = 'F',178 alias = "literal",179 hide_short_help = true,180 long_help = "Treat the pattern as a literal string instead of a regular expression. Note \181 that this also performs substring comparison. If you want to match on an \182 exact filename, consider using '--glob'."183 )]184 pub fixed_strings: bool,185 /// Show absolute instead of relative paths155 ///156 /// Shows the full path starting with the root as opposed to relative paths.157 /// The flag can be overridden with --relative-path.158 #[arg(long, short = 'a')]186 #[arg(187 long,188 short = 'a',189 long_help = "Shows the full path starting from the root as opposed to relative paths. \190 The flag can be overridden with --relative-path."191 )]192 pub absolute_path: bool,193 /// Use a long listing format with file metadata161 ///162 /// Use a detailed listing format like 'ls -l'. This is basically an alias163 /// for '--exec-batch ls -l' with some additional 'ls' options. This can be164 /// used to see more metadata, to show symlink targets and to achieve a165 /// deterministic sort order.166 #[arg(long, short = 'l', conflicts_with("absolute_path"))]194 #[arg(195 long,196 short = 'l',197 conflicts_with("absolute_path"),198 long_help = "Use a detailed listing format like 'ls -l'. This is basically an alias \199 for '--exec-batch ls -l' with some additional 'ls' options. This can be \200 used to see more metadata, to show symlink targets and to achieve a \201 deterministic sort order."202 )]203 pub list_details: bool,204 /// Follow symbolic links169 ///170 /// By default, fd does not descend into symlinked directories. Using this171 /// flag, symbolic links are also traversed.172 /// Flag can be overridden with --no-follow.173 #[arg(long, short = 'L', alias = "dereference")]205 #[arg(206 long,207 short = 'L',208 alias = "dereference",209 long_help = "By default, fd does not descend into symlinked directories. Using this \210 flag, symbolic links are also traversed. \211 Flag can be overriden with --no-follow."212 )]213 pub follow: bool,214 /// Search full abs. path (default: filename only)176 ///177 /// By default, the search pattern is only matched against the filename (or178 /// directory name). Using this flag, the pattern is matched against the full179 /// (absolute) path.180 /// Example:181 /// fd --glob -p '**/.git/config'182 #[arg(long, short = 'p', verbatim_doc_comment)]215 #[arg(216 long,217 short = 'p',218 long_help = "By default, the search pattern is only matched against the filename (or \219 directory name). Using this flag, the pattern is matched against the full \220 (absolute) path. Example:\n \221 fd --glob -p '**/.git/config'"222 )]223 pub full_path: bool,184 /// Separate search results by the null character (instead of newlines).185 /// Useful for piping results to 'xargs'.224 /// Separate search results by the null character225 #[arg(226 long = "print0",227 short = '0',228 conflicts_with("list_details"),190 hide_short_help = true229 hide_short_help = true,230 long_help = "Separate search results by the null character (instead of newlines). \231 Useful for piping results to 'xargs'."232 )]233 pub null_separator: bool,234 /// Set maximum search depth (default: none)194 ///195 /// Limit the directory traversal to a given depth. By default, there is no196 /// limit on the search depth.197 #[arg(long, short = 'd', value_name = "depth", alias("maxdepth"))]235 #[arg(236 long,237 short = 'd',238 value_name = "depth",239 alias("maxdepth"),240 long_help = "Limit the directory traversal to a given depth. By default, there is no \241 limit on the search depth."242 )]243 max_depth: Option<usize>,244 /// Only show search results starting at the given depth.200 /// See also: '--max-depth' and '--exact-depth'201 #[arg(long, value_name = "depth", hide_short_help = true)]245 #[arg(246 long,247 value_name = "depth",248 hide_short_help = true,249 long_help = "Only show search results starting at the given depth. \250 See also: '--max-depth' and '--exact-depth'"251 )]252 min_depth: Option<usize>,203 /// Only show search results at the exact given depth. This is an alias for204 /// '--min-depth <depth> --max-depth <depth>'.205 #[arg(long, value_name = "depth", hide_short_help = true, conflicts_with_all(&["max_depth", "min_depth"]))]253 /// Only show search results at the exact given depth254 #[arg(long, value_name = "depth", hide_short_help = true, conflicts_with_all(&["max_depth", "min_depth"]),255 long_help = "Only show search results at the exact given depth. This is an alias for \256 '--min-depth <depth> --max-depth <depth>'.",257 )]258 exact_depth: Option<usize>,259 /// Do not traverse into directories that match the search criteria. If260 /// you want to exclude specific directories, use the '--exclude=…' option.209 #[arg(long, hide_short_help = true, conflicts_with_all(&["size", "exact_depth"]))]261 #[arg(long, hide_short_help = true, conflicts_with_all(&["size", "exact_depth"]),262 long_help = "Do not traverse into directories that match the search criteria. If \263 you want to exclude specific directories, use the '--exclude=…' option.",264 )]265 pub prune: bool,266 /// Filter by type: file (f), directory (d), symlink (l),267 /// executable (x), empty (e), socket (s), pipe (p)213 ///214 /// Filter the search by type:215 ///216 /// 'f' or 'file': regular files217 /// 'd' or 'directory': directories218 /// 'l' or 'symlink': symbolic links219 /// 's' or 'socket': socket220 /// 'p' or 'pipe': named pipe (FIFO)221 ///222 /// 'x' or 'executable': executables223 /// 'e' or 'empty': empty files or directories224 ///225 /// This option can be specified more than once to include multiple file types.226 /// Searching for '--type file --type symlink' will show both regular files as227 /// well as symlinks. Note that the 'executable' and 'empty' filters work differently:228 /// '--type executable' implies '--type file' by default. And '--type empty' searches229 /// for empty files and directories, unless either '--type file' or '--type directory'230 /// is specified in addition.231 ///232 /// Examples:233 ///234 /// - Only search for files:235 /// fd --type file …236 /// fd -tf …237 /// - Find both files and symlinks238 /// fd --type file --type symlink …239 /// fd -tf -tl …240 /// - Find executable files:241 /// fd --type executable242 /// fd -tx243 /// - Find empty files:244 /// fd --type empty --type file245 /// fd -te -tf246 /// - Find empty directories:247 /// fd --type empty --type directory248 /// fd -te -td"268 #[arg(269 long = "type",270 short = 't',271 value_name = "filetype",272 hide_possible_values = true,273 value_enum,255 verbatim_doc_comment274 long_help = "Filter the search by type:\n \275 'f' or 'file': regular files\n \276 'd' or 'directory': directories\n \277 'l' or 'symlink': symbolic links\n \278 's' or 'socket': socket\n \279 'p' or 'pipe': named pipe (FIFO)\n\n \280 'x' or 'executable': executables\n \281 'e' or 'empty': empty files or directories\n\n\282 This option can be specified more than once to include multiple file types. \283 Searching for '--type file --type symlink' will show both regular files as \284 well as symlinks. Note that the 'executable' and 'empty' filters work differently: \285 '--type executable' implies '--type file' by default. And '--type empty' searches \286 for empty files and directories, unless either '--type file' or '--type directory' \287 is specified in addition.\n\n\288 Examples:\n \289 - Only search for files:\n \290 fd --type file …\n \291 fd -tf …\n \292 - Find both files and symlinks\n \293 fd --type file --type symlink …\n \294 fd -tf -tl …\n \295 - Find executable files:\n \296 fd --type executable\n \297 fd -tx\n \298 - Find empty files:\n \299 fd --type empty --type file\n \300 fd -te -tf\n \301 - Find empty directories:\n \302 fd --type empty --type directory\n \303 fd -te -td"304 )]305 pub filetype: Option<Vec<FileType>>,306 /// Filter by file extension259 ///260 /// (Additionally) filter search results by their file extension. Multiple261 /// allowable file extensions can be specified.262 /// If you want to search for files without extension,263 /// you can use the regex '^[^.]+$' as a normal search pattern.264 #[arg(long = "extension", short = 'e', value_name = "ext")]307 #[arg(308 long = "extension",309 short = 'e',310 value_name = "ext",311 long_help = "(Additionally) filter search results by their file extension. Multiple \312 allowable file extensions can be specified.\n\313 If you want to search for files without extension, \314 you can use the regex '^[^.]+$' as a normal search pattern."315 )]316 pub extensions: Option<Vec<String>>,317318 #[command(flatten)]319 pub exec: Exec,320270 /// Maximum number of arguments to pass to the command given with -X.271 /// If the number of results is greater than the given size,272 /// the command given with -X is run again with remaining arguments.273 /// A batch size of zero means there is no limit (default), but note274 /// that batching might still happen due to OS restrictions on the275 /// maximum length of command lines.321 /// Max number of arguments to run as a batch size with -X322 #[arg(323 long,324 value_name = "size",325 hide_short_help = true,326 requires("exec_batch"),327 value_parser = value_parser!(usize),282 default_value_t328 default_value_t,329 long_help = "Maximum number of arguments to pass to the command given with -X. \330 If the number of results is greater than the given size, \331 the command given with -X is run again with remaining arguments. \332 A batch size of zero means there is no limit (default), but note \333 that batching might still happen due to OS restrictions on the \334 maximum length of command lines.",335 )]336 pub batch_size: usize,337 /// Exclude entries that match the given glob pattern286 ///287 /// Exclude files/directories that match the given glob pattern. This overrides any other288 /// ignore logic. Multiple exclude patterns can be specified.289 ///290 /// Examples:291 /// --exclude '*.pyc'292 /// --exclude node_modules293 #[arg(long, short = 'E', value_name = "pattern", verbatim_doc_comment)]338 #[arg(339 long,340 short = 'E',341 value_name = "pattern",342 long_help = "Exclude files/directories that match the given glob pattern. This \343 overrides any other ignore logic. Multiple exclude patterns can be \344 specified.\n\n\345 Examples:\n \346 --exclude '*.pyc'\n \347 --exclude node_modules"348 )]349 pub exclude: Vec<String>,295 /// Add a custom ignore-file in '.gitignore' format. These files have a low296 /// precedence.297 #[arg(long, value_name = "path", hide_short_help = true)]350 /// Add a custom ignore-file in '.gitignore' format351 #[arg(352 long,353 value_name = "path",354 hide_short_help = true,355 long_help = "Add a custom ignore-file in '.gitignore' format. These files have a low precedence"356 )]357 pub ignore_file: Vec<PathBuf>,358 /// When to use colors359 #[arg(360 long,361 short = 'c',362 value_enum,363 default_value_t = ColorWhen::Auto,364 value_name = "when",306 verbatim_doc_comment365 long_help = "Declare when to use color for the pattern match output",366 )]367 pub color: ColorWhen,368 /// Set number of threads to use for searching & executing (default: number369 /// of available CPU cores)370 #[arg(long, short = 'j', value_name = "num", hide_short_help = true, value_parser = 1..)]371 pub threads: Option<u32>,372 /// Limit results based on the size of files314 ///315 /// Limit results based on the size of files using the format <+-><NUM><UNIT>.316 /// '+': file size must be greater than or equal to this317 /// '-': file size must be less than or equal to this318 /// If neither '+' nor '-' is specified, file size must be exactly equal to this.319 /// 'NUM': The numeric size (e.g. 500)320 /// 'UNIT': The units for NUM. They are not case-sensitive.321 /// Allowed unit values:322 /// 'b': bytes323 /// 'k': kilobytes (base ten, 10^3 = 1000 bytes)324 /// 'm': megabytes325 /// 'g': gigabytes326 /// 't': terabytes327 /// 'ki': kibibytes (base two, 2^10 = 1024 bytes)328 /// 'mi': mebibytes329 /// 'gi': gibibytes330 /// 'ti': tebibytes331 #[arg(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, verbatim_doc_comment, value_name = "size")]373 #[arg(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, verbatim_doc_comment, value_name = "size",374 long_help = "Limit results based on the size of files using the format <+-><NUM><UNIT>.\n \375 '+': file size must be greater than or equal to this\n \376 '-': file size must be less than or equal to this\n\377 If neither '+' nor '-' is specified, file size must be exactly equal to this.\n \378 'NUM': The numeric size (e.g. 500)\n \379 'UNIT': The units for NUM. They are not case-sensitive.\n\380 Allowed unit values:\n \381 'b': bytes\n \382 'k': kilobytes (base ten, 10^3 = 1000 bytes)\n \383 'm': megabytes\n \384 'g': gigabytes\n \385 't': terabytes\n \386 'ki': kibibytes (base two, 2^10 = 1024 bytes)\n \387 'mi': mebibytes\n \388 'gi': gibibytes\n \389 'ti': tebibytes",390 )]391 pub size: Vec<SizeFilter>,392 /// Milliseconds to buffer before streaming search results to console393 ///394 /// Amount of time in milliseconds to buffer, before streaming the search395 /// results to the console.396 #[arg(long, hide = true, value_parser = parse_millis)]397 pub max_buffer_time: Option<Duration>,398 /// Filter by file modification time (newer than)340 ///341 /// The argument can be provided as a specific point in time (YYYY-MM-DD HH:MM:SS)342 /// or as a duration (10h, 1d, 35min).343 /// If the time is not specified, it defaults to 00:00:00.344 /// '--change-newer-than' or '--newer' can be used as aliases.345 /// Examples:346 /// --changed-within 2weeks347 /// --change-newer-than '2018-10-27 10:00:00'348 /// --newer 2018-10-27399 #[arg(400 long,401 alias("change-newer-than"),402 alias("newer"),403 value_name = "date|dur",354 verbatim_doc_comment404 long_help = "Filter results based on the file modification time. The argument can be provided \405 as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \406 If the time is not specified, it defaults to 00:00:00. \407 '--change-newer-than' or '--newer' can be used as aliases.\n\408 Examples:\n \409 --changed-within 2weeks\n \410 --change-newer-than '2018-10-27 10:00:00'\n \411 --newer 2018-10-27"412 )]413 pub changed_within: Option<String>,414 /// Filter by file modification time (older than)358 ///359 /// The argument can be provided as a specific point in time (YYYY-MM-DD HH:MM:SS)360 /// or as a duration (10h, 1d, 35min).361 /// '--change-older-than' or '--older' can be used as aliases.362 ///363 /// Examples:364 /// --changed-before '2018-10-27 10:00:00'365 /// --change-older-than 2weeks366 /// --older 2018-10-27415 #[arg(416 long,417 alias("change-older-than"),418 alias("older"),419 value_name = "date|dur",372 verbatim_doc_comment420 long_help = "Filter results based on the file modification time. The argument can be provided \421 as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \422 '--change-older-than' or '--older' can be used as aliases.\n\423 Examples:\n \424 --changed-before '2018-10-27 10:00:00'\n \425 --change-older-than 2weeks\n \426 --older 2018-10-27"427 )]428 pub changed_before: Option<String>,429 /// Limit number of search results376 ///377 /// Limit the number of search results to 'count' and quit immediately.378 #[arg(long, value_name = "count", hide_short_help = true)]430 #[arg(431 long,432 value_name = "count",433 hide_short_help = true,434 long_help = "Limit the number of search results to 'count' and quit immediately."435 )]436 max_results: Option<usize>,380 /// Limit search to a single result and quit immediately381 ///382 /// This is an alias for '--max-results=1'.383 #[arg(short = '1', hide_short_help = true, overrides_with("max_results"))]437 /// Limit search to a single result438 #[arg(439 short = '1',440 hide_short_help = true,441 overrides_with("max_results"),442 long_help = "Limit the search to a single result and quit immediately. \443 This is an alias for '--max-results=1'."444 )]445 max_one_result: bool,446 /// Print nothing, exit code 0 if match found, 1 otherwise386 ///387 /// When the flag is present, the program does not print anything and will388 /// return with an exit code of 0 if there is at least one match. Otherwise, the389 /// exit code will be 1.390 ///391 /// '--has-results' can be used as an alias.447 #[arg(448 long,449 short = 'q',450 alias = "has-results",451 hide_short_help = true,397 conflicts_with("max_results")452 conflicts_with("max_results"),453 long_help = "When the flag is present, the program does not print anything and will \454 return with an exit code of 0 if there is at least one match. Otherwise, the \455 exit code will be 1. \456 '--has-results' can be used as an alias."457 )]458 pub quiet: bool,459 /// Show filesystem errors401 ///402 ///Enable the display of filesystem errors for situations such as403 ///insufficient permissions or dead symlinks.404 #[arg(long, hide_short_help = true)]460 #[arg(461 long,462 hide_short_help = true,463 long_help = "Enable the display of filesystem errors for situations such as \464 insufficient permissions or dead symlinks."465 )]466 pub show_errors: bool,406 /// Change the current working directory of fd to the provided path. This407 /// means that search results will be shown with respect to the given base408 /// path. Note that relative paths which are passed to fd via the positional409 /// <path> argument or the '--search-path' option will also be resolved410 /// relative to this directory.411 #[arg(long, value_name = "path", hide_short_help = true)]467 /// Change current working directory468 #[arg(469 long,470 value_name = "path",471 hide_short_help = true,472 long_help = "Change the current working directory of fd to the provided path. This \473 means that search results will be shown with respect to the given base \474 path. Note that relative paths which are passed to fd via the positional \475 <path> argument or the '--search-path' option will also be resolved \476 relative to this directory."477 )]478 pub base_directory: Option<PathBuf>,479 /// the search pattern (a regular expression, unless '--glob' is used; optional)414 ///415 /// the search pattern which is either a regular expression (default) or a glob416 /// pattern (if --glob is used). If no pattern has been specified, every entry417 /// is considered a match. If your pattern starts with a dash (-), make sure to418 /// pass '--' first, or it will be considered as a flag (fd -- '-foo').419 #[arg(default_value = "", hide_default_value = true)]480 #[arg(481 default_value = "",482 hide_default_value = true,483 value_name = "pattern",484 long_help = "the search pattern which is either a regular expression (default) or a glob \485 pattern (if --glob is used). If no pattern has been specified, every entry \486 is considered a match. If your pattern starts with a dash (-), make sure to \487 pass '--' first, or it will be considered as a flag (fd -- '-foo')."488 )]489 pub pattern: String,490 /// Set path separator when printing file paths422 /// Set the path separator to use when printing file paths. The default is423 /// the OS-specific separator ('/' on Unix, '\\' on Windows).424 #[arg(long, value_name = "separator", hide_short_help = true)]491 #[arg(492 long,493 value_name = "separator",494 hide_short_help = true,495 long_help = "Set the path separator to use when printing file paths. The default is \496 the OS-specific separator ('/' on Unix, '\\' on Windows)."497 )]498 pub path_separator: Option<String>,499 /// the root directories for the filesystem search (optional)427 ///428 /// The directories where the filesystem search is rooted.429 /// If omitted, search the current working directory.430 #[arg(action = ArgAction::Append)]500 #[arg(action = ArgAction::Append,501 value_name = "path",502 long_help = "The directory where the filesystem search is rooted (optional). If \503 omitted, search the current working directory.",504 )]505 path: Vec<PathBuf>,506 /// Provides paths to search as an alternative to the positional <path> argument433 ///434 /// Changes the usage to `fd [OPTIONS] --search-path <path> --search-path <path2> [<pattern>]`435 #[arg(long, conflicts_with("path"), hide_short_help = true)]507 #[arg(508 long,509 conflicts_with("path"),510 value_name = "search-path",511 hide_short_help = true,512 long_help = "Provide paths to search as an alternative to the positional <path> \513 argument. Changes the usage to `fd [OPTIONS] --search-path <path> \514 --search-path <path2> [<pattern>]`"515 )]516 search_path: Vec<PathBuf>,437 /// strip './' prefix from -0/--print-0 output438 ///517 /// By default, relative paths are prefixed with './' when -x/--exec,518 /// -X/--exec-batch, or -0/--print0 are given, to reduce the risk of a519 /// path starting with '-' being treated as a command line option. Use520 /// this flag to disable this behaviour.443 #[arg(long, conflicts_with_all(&["path", "search_path"]), hide_short_help = true)]521 #[arg(long, conflicts_with_all(&["path", "search_path"]), hide_short_help = true,522 long_help = "By default, relative paths are prefixed with './' when -x/--exec, \523 -X/--exec-batch, or -0/--print0 are given, to reduce the risk of a \524 path starting with '-' being treated as a command line option. Use \525 this flag to disable this behaviour.",526 )]527 pub strip_cwd_prefix: bool,528 /// Filter by owning user and/or group446 ///447 /// Format: [(user|uid)][:(group|gid)].448 /// Either side is optional. Precede either side with a '!' to exclude files instead.449 ///450 /// Examples:451 /// --owner john452 /// --owner :students453 /// --owner '!john:students'529 #[cfg(unix)]455 #[arg(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group", verbatim_doc_comment)]530 #[arg(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group",531 long_help = "Filter files by their user and/or group. \532 Format: [(user|uid)][:(group|gid)]. Either side is optional. \533 Precede either side with a '!' to exclude files instead.\n\534 Examples:\n \535 --owner john\n \536 --owner :students\n \537 --owner '!john:students'"538 )]539 pub owner: Option<OwnerFilter>,457 /// Do not descend into a different file system458 ///459 /// By default, fd will traverse the file system tree as far as other options460 /// dictate. With this flag, fd ensures that it does not descend into a461 /// different file system than the one it started in. Comparable to the -mount462 /// or -xdev filters of find(1).540 #[cfg(any(unix, windows))]464 #[arg(long, aliases(&["mount", "xdev"]), hide_short_help = true)]541 #[arg(long, aliases(&["mount", "xdev"]), hide_short_help = true,542 long_help = "By default, fd will traverse the file system tree as far as other options \543 dictate. With this flag, fd ensures that it does not descend into a \544 different file system than the one it started in. Comparable to the -mount \545 or -xdev filters of find(1).")]546 pub one_file_system: bool,547548 #[cfg(feature = "completions")]549 #[arg(long, hide = true, exclusive = true)]
139 unmodified lines
689 pub fn as_str(&self) -> &'static str {690 use ColorWhen::*;691 match *self {692 Auto => "auto",612 Always => "always",693 Never => "never",694 Always => "always",695 }696 }697}698
108 unmodified lines