Skip to content
Myr

Merge pull request #1171 from tmccombs/clap-derive-comments

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

Use docstrings for long help in clap derive

authored by David Peter · committed by GitHub · parents 614e637, b7a2f68 · Browse files · 1 file+244 added−207 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+244 added−207 removed

  • other:+244 added−207 removed

1 file+244 added−207 removed

modified:src/cli.rs+244 added-207 removed
27 unmodified lines
28 group(ArgGroup::new("execs").args(&["exec", "exec_batch", "list_details"]).conflicts_with_all(&[29 "max_results", "has_results", "count"])),30)]31pub struct Opts {32 /// Search hidden files and directories32 /// Include hidden directories and files in the search results (default:33 /// hidden files and directories are skipped). Files and directories are34 /// considered to be hidden if their name starts with a `.` sign (dot).35 /// The flag can be overridden with --no-hidden.36 #[arg(37 long,38 short = 'H',36 long_help = "Include hidden directories and files in the search results (default: \37 hidden files and directories are skipped). Files and directories are \38 considered to be hidden if their name starts with a `.` sign (dot). \39 The flag can be overridden with --no-hidden."39 help = "Search hidden files and directories",40 long_help41 )]42 pub hidden: bool,4344 /// Overrides --hidden45 #[arg(long, overrides_with = "hidden", hide = true, action = ArgAction::SetTrue)]46 no_hidden: (),4747 /// Do not respect .(git|fd)ignore files48 /// Show search results from files and directories that would otherwise be49 /// ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.50 /// The flag can be overridden with --ignore.51 #[arg(52 long,53 short = 'I',51 long_help = "Show search results from files and directories that would otherwise be \52 ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file. \53 The flag can be overridden with --ignore."54 help = "Do not respect .(git|fd)ignore files",55 long_help56 )]57 pub no_ignore: bool,5859 /// Overrides --no-ignore60 #[arg(long, overrides_with = "no_ignore", hide = true, action = ArgAction::SetTrue)]61 ignore: (),6261 /// Do not respect .gitignore files63 ///Show search results from files and directories that would otherwise be64 /// ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs.65 #[arg(66 long,67 hide_short_help = true,65 long_help = "Show search results from files and directories that would otherwise be \66 ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs."68 help = "Do not respect .gitignore files",69 long_help70 )]71 pub no_ignore_vcs: bool,7273 /// Overrides --no-ignore-vcs74 #[arg(long, overrides_with = "no_ignore_vcs", hide = true, action = ArgAction::SetTrue)]75 ignore_vcs: (),7674 /// Do not respect .(git|fd)ignore files in parent directories77 /// Show search results from files and directories that would otherwise be78 /// ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories.79 #[arg(80 long,81 hide_short_help = true,78 long_help = "Show search results from files and directories that would otherwise be \79 ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories."82 help = "Do not respect .(git|fd)ignore files in parent directories",83 long_help84 )]85 pub no_ignore_parent: bool,8687 /// Do not respect the global ignore file88 #[arg(long, hide = true)]89 pub no_global_ignore_file: bool,9087 /// Unrestricted search, alias for '--no-ignore --hidden'91 /// Perform an unrestricted search, including ignored and hidden files. This is92 /// an alias for '--no-ignore --hidden'.93 #[arg(long = "unrestricted", short = 'u', overrides_with_all(&["ignore", "no_hidden"]), action(ArgAction::Count), hide_short_help = true,89 long_help = "Perform an unrestricted search, including ignored and hidden files. This is \90 an alias for '--no-ignore --hidden'."94 help = "Unrestricted search, alias for '--no-ignore --hidden'",95 long_help,96 )]97 rg_alias_hidden_ignore: u8,9899 /// Case-sensitive search (default: smart case)
6 unmodified lines
106 case)."107 )]108 pub case_sensitive: bool,109105 /// Case-insensitive search (default: smart case)110 /// Perform a case-insensitive search. By default, fd uses case-insensitive111 /// searches, unless the pattern contains an uppercase character (smart112 /// case).113 #[arg(114 long,115 short = 'i',116 overrides_with("case_sensitive"),110 long_help = "Perform a case-insensitive search. By default, fd uses case-insensitive \111 searches, unless the pattern contains an uppercase character (smart \112 case)."117 help = "Case-insensitive search (default: smart case)",118 long_help119 )]120 pub ignore_case: bool,121116 /// Glob-based search (default: regular expression)122 /// Perform a glob-based search instead of a regular expression search.123 #[arg(124 long,125 short = 'g',126 conflicts_with("fixed_strings"),121 long_help = "Perform a glob-based search instead of a regular expression search."127 help = "Glob-based search (default: regular expression)",128 long_help129 )]130 pub glob: bool,131125 /// Regular-expression based search (default)132 /// Perform a regular-expression based search (default). This can be used to133 /// override --glob.134 #[arg(135 long,136 overrides_with("glob"),137 hide_short_help = true,130 long_help = "Perform a regular-expression based search (default). This can be used to \131 override --glob."138 help = "Regular-expression based search (default)",139 long_help140 )]141 pub regex: bool,142135 /// Treat pattern as literal string stead of regex143 /// Treat the pattern as a literal string instead of a regular expression. Note144 /// that this also performs substring comparison. If you want to match on an145 /// exact filename, consider using '--glob'.146 #[arg(147 long,148 short = 'F',149 alias = "literal",150 hide_short_help = true,141 long_help = "Treat the pattern as a literal string instead of a regular expression. Note \142 that this also performs substring comparison. If you want to match on an \143 exact filename, consider using '--glob'."151 help = "Treat pattern as literal string stead of regex",152 long_help153 )]154 pub fixed_strings: bool,155147 /// Additional search patterns that need to be matched156 /// Add additional required search patterns, all of which must be matched. Multiple157 /// additional patterns can be specified. The patterns are regular158 /// expressions, unless '--glob' or '--fixed-strings' is used.159 #[arg(160 long = "and",161 value_name = "pattern",151 long_help = "Add additional required search patterns, all of which must be matched. Multiple \152 additional patterns can be specified. The patterns are regular expressions, \153 unless '--glob' or '--fixed-strings' is used.",162 help = "Additional search patterns that need to be matched",163 long_help,164 hide_short_help = true,165 allow_hyphen_values = true166 )]167 pub exprs: Option<Vec<String>>,168159 /// Show absolute instead of relative paths169 /// Shows the full path starting from the root as opposed to relative paths.170 /// The flag can be overridden with --relative-path.171 #[arg(172 long,173 short = 'a',163 long_help = "Shows the full path starting from the root as opposed to relative paths. \164 The flag can be overridden with --relative-path."174 help = "Show absolute instead of relative paths",175 long_help176 )]177 pub absolute_path: bool,178179 /// Overrides --absolute-path180 #[arg(long, overrides_with = "absolute_path", hide = true, action = ArgAction::SetTrue)]181 relative_path: (),182172 /// Use a long listing format with file metadata183 /// Use a detailed listing format like 'ls -l'. This is basically an alias184 /// for '--exec-batch ls -l' with some additional 'ls' options. This can be185 /// used to see more metadata, to show symlink targets and to achieve a186 /// deterministic sort order.187 #[arg(188 long,189 short = 'l',190 conflicts_with("absolute_path"),177 long_help = "Use a detailed listing format like 'ls -l'. This is basically an alias \178 for '--exec-batch ls -l' with some additional 'ls' options. This can be \179 used to see more metadata, to show symlink targets and to achieve a \180 deterministic sort order."191 help = "Use a long listing format with file metadata",192 long_help193 )]194 pub list_details: bool,195196 /// Follow symbolic links
10 unmodified lines
207 /// Overrides --follow208 #[arg(long, overrides_with = "follow", hide = true, action = ArgAction::SetTrue)]209 no_follow: (),210199 /// Search full abs. path (default: filename only)211 /// By default, the search pattern is only matched against the filename (or directory name). Using this flag, the pattern is matched against the full (absolute) path. Example:212 /// fd --glob -p '**/.git/config'213 #[arg(214 long,215 short = 'p',203 long_help = "By default, the search pattern is only matched against the filename (or \204 directory name). Using this flag, the pattern is matched against the full \205 (absolute) path. Example:\n \206 fd --glob -p '**/.git/config'"216 help = "Search full abs. path (default: filename only)",217 long_help,218 verbatim_doc_comment219 )]220 pub full_path: bool,221210 /// Separate search results by the null character222 /// Separate search results by the null character (instead of newlines).223 /// Useful for piping results to 'xargs'.224 #[arg(225 long = "print0",226 short = '0',227 conflicts_with("list_details"),228 hide_short_help = true,216 long_help = "Separate search results by the null character (instead of newlines). \217 Useful for piping results to 'xargs'."229 help = "Separate search results by the null character",230 long_help231 )]232 pub null_separator: bool,233221 /// Set maximum search depth (default: none)234 /// Limit the directory traversal to a given depth. By default, there is no235 /// limit on the search depth.236 #[arg(237 long,238 short = 'd',239 value_name = "depth",240 alias("maxdepth"),227 long_help = "Limit the directory traversal to a given depth. By default, there is no \228 limit on the search depth."241 help = "Set maximum search depth (default: none)",242 long_help243 )]244 max_depth: Option<usize>,245246 /// Only show search results starting at the given depth.247 /// See also: '--max-depth' and '--exact-depth'248 #[arg(249 long,250 value_name = "depth",251 hide_short_help = true,237 long_help = "Only show search results starting at the given depth. \238 See also: '--max-depth' and '--exact-depth'"252 help = "Only show search results starting at the given depth.",253 long_help254 )]255 min_depth: Option<usize>,256242 /// Only show search results at the exact given depth257 /// Only show search results at the exact given depth. This is an alias for258 /// '--min-depth <depth> --max-depth <depth>'.259 #[arg(long, value_name = "depth", hide_short_help = true, conflicts_with_all(&["max_depth", "min_depth"]),244 long_help = "Only show search results at the exact given depth. This is an alias for \245 '--min-depth <depth> --max-depth <depth>'.",260 help = "Only show search results at the exact given depth",261 long_help,262 )]263 exact_depth: Option<usize>,264249 /// Exclude entries that match the given glob pattern265 /// Exclude files/directories that match the given glob pattern. This266 /// overrides any other ignore logic. Multiple exclude patterns can be267 /// specified.268 ///269 /// Examples:270 /// {n} --exclude '*.pyc'271 /// {n} --exclude node_modules272 #[arg(273 long,274 short = 'E',275 value_name = "pattern",254 long_help = "Exclude files/directories that match the given glob pattern. This \255 overrides any other ignore logic. Multiple exclude patterns can be \256 specified.\n\n\257 Examples:\n \258 --exclude '*.pyc'\n \259 --exclude node_modules"276 help = "Exclude entries that match the given glob pattern",277 long_help278 )]279 pub exclude: Vec<String>,280281 /// Do not traverse into directories that match the search criteria. If282 /// you want to exclude specific directories, use the '--exclude=…' option.283 #[arg(long, hide_short_help = true, conflicts_with_all(&["size", "exact_depth"]),266 long_help = "Do not traverse into directories that match the search criteria. If \267 you want to exclude specific directories, use the '--exclude=…' option.",284 long_help,285 )]286 pub prune: bool,287271 /// Filter by type: file (f), directory (d), symlink (l),272 /// executable (x), empty (e), socket (s), pipe (p)288 /// Filter the search by type:289 /// {n} 'f' or 'file': regular files290 /// {n} 'd' or 'directory': directories291 /// {n} 'l' or 'symlink': symbolic links292 /// {n} 's' or 'socket': socket293 /// {n} 'p' or 'pipe': named pipe (FIFO)294 /// {n}{n} 'x' or 'executable': executables295 /// {n} 'e' or 'empty': empty files or directories296 ///297 /// This option can be specified more than once to include multiple file types.298 /// Searching for '--type file --type symlink' will show both regular files as299 /// well as symlinks. Note that the 'executable' and 'empty' filters work differently:300 /// '--type executable' implies '--type file' by default. And '--type empty' searches301 /// for empty files and directories, unless either '--type file' or '--type directory'302 /// is specified in addition.303 ///304 /// Examples:305 /// {n} - Only search for files:306 /// {n} fd --type file …307 /// {n} fd -tf …308 /// {n} - Find both files and symlinks309 /// {n} fd --type file --type symlink …310 /// {n} fd -tf -tl …311 /// {n} - Find executable files:312 /// {n} fd --type executable313 /// {n} fd -tx314 /// {n} - Find empty files:315 /// {n} fd --type empty --type file316 /// {n} fd -te -tf317 /// {n} - Find empty directories:318 /// {n} fd --type empty --type directory319 /// {n} fd -te -td320 #[arg(321 long = "type",322 short = 't',323 value_name = "filetype",324 hide_possible_values = true,325 value_enum,279 long_help = "Filter the search by type:\n \280 'f' or 'file': regular files\n \281 'd' or 'directory': directories\n \282 'l' or 'symlink': symbolic links\n \283 's' or 'socket': socket\n \284 'p' or 'pipe': named pipe (FIFO)\n\n \285 'x' or 'executable': executables\n \286 'e' or 'empty': empty files or directories\n\n\287 This option can be specified more than once to include multiple file types. \288 Searching for '--type file --type symlink' will show both regular files as \289 well as symlinks. Note that the 'executable' and 'empty' filters work differently: \290 '--type executable' implies '--type file' by default. And '--type empty' searches \291 for empty files and directories, unless either '--type file' or '--type directory' \292 is specified in addition.\n\n\293 Examples:\n \294 - Only search for files:\n \295 fd --type file …\n \296 fd -tf …\n \297 - Find both files and symlinks\n \298 fd --type file --type symlink …\n \299 fd -tf -tl …\n \300 - Find executable files:\n \301 fd --type executable\n \302 fd -tx\n \303 - Find empty files:\n \304 fd --type empty --type file\n \305 fd -te -tf\n \306 - Find empty directories:\n \307 fd --type empty --type directory\n \308 fd -te -td"326 help = "Filter by type: file (f), directory (d), symlink (l), \327 executable (x), empty (e), socket (s), pipe (p)",328 long_help329 )]330 pub filetype: Option<Vec<FileType>>,331312 /// Filter by file extension332 /// (Additionally) filter search results by their file extension. Multiple333 /// allowable file extensions can be specified.334 ///335 /// If you want to search for files without extension,336 /// you can use the regex '^[^.]+$' as a normal search pattern.337 #[arg(338 long = "extension",339 short = 'e',340 value_name = "ext",317 long_help = "(Additionally) filter search results by their file extension. Multiple \318 allowable file extensions can be specified.\n\319 If you want to search for files without extension, \320 you can use the regex '^[^.]+$' as a normal search pattern."341 help = "Filter by file extension",342 long_help343 )]344 pub extensions: Option<Vec<String>>,345324 /// Limit results based on the size of files346 /// Limit results based on the size of files using the format <+-><NUM><UNIT>.347 /// '+': file size must be greater than or equal to this348 /// '-': file size must be less than or equal to this349 ///350 /// If neither '+' nor '-' is specified, file size must be exactly equal to this.351 /// 'NUM': The numeric size (e.g. 500)352 /// 'UNIT': The units for NUM. They are not case-sensitive.353 /// Allowed unit values:354 /// 'b': bytes355 /// 'k': kilobytes (base ten, 10^3 = 1000 bytes)356 /// 'm': megabytes357 /// 'g': gigabytes358 /// 't': terabytes359 /// 'ki': kibibytes (base two, 2^10 = 1024 bytes)360 /// 'mi': mebibytes361 /// 'gi': gibibytes362 /// 'ti': tebibytes363 #[arg(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, verbatim_doc_comment, value_name = "size",326 long_help = "Limit results based on the size of files using the format <+-><NUM><UNIT>.\n \327 '+': file size must be greater than or equal to this\n \328 '-': file size must be less than or equal to this\n\329 If neither '+' nor '-' is specified, file size must be exactly equal to this.\n \330 'NUM': The numeric size (e.g. 500)\n \331 'UNIT': The units for NUM. They are not case-sensitive.\n\332 Allowed unit values:\n \333 'b': bytes\n \334 'k': kilobytes (base ten, 10^3 = 1000 bytes)\n \335 'm': megabytes\n \336 'g': gigabytes\n \337 't': terabytes\n \338 'ki': kibibytes (base two, 2^10 = 1024 bytes)\n \339 'mi': mebibytes\n \340 'gi': gibibytes\n \341 'ti': tebibytes",364 help = "Limit results based on the size of files",365 long_help,366 verbatim_doc_comment,367 )]368 pub size: Vec<SizeFilter>,369345 /// Filter by file modification time (newer than)370 /// Filter results based on the file modification time. Files with modification times371 /// greater than the argument are returned. The argument can be provided372 /// as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min).373 /// If the time is not specified, it defaults to 00:00:00.374 /// '--change-newer-than', '--newer', or '--changed-after' can be used as aliases.375 ///376 /// Examples:377 /// {n} --changed-within 2weeks378 /// {n} --change-newer-than '2018-10-27 10:00:00'379 /// {n} --newer 2018-10-27380 /// {n} --changed-after 1day381 #[arg(382 long,383 alias("change-newer-than"),384 alias("newer"),385 alias("changed-after"),386 value_name = "date|dur",352 long_help = "Filter results based on the file modification time. \353 Files with modification times greater than the argument are returned. \354 The argument can be provided \355 as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \356 If the time is not specified, it defaults to 00:00:00. \357 '--change-newer-than' or '--newer' can be used as aliases.\n\358 Examples:\n \359 --changed-within 2weeks\n \360 --change-newer-than '2018-10-27 10:00:00'\n \361 --newer 2018-10-27"387 help = "Filter by file modification time (newer than)",388 long_help389 )]390 pub changed_within: Option<String>,391365 /// Filter by file modification time (older than)392 /// Filter results based on the file modification time. Files with modification times393 /// less than the argument are returned. The argument can be provided394 /// as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min).395 /// '--change-older-than' or '--older' can be used as aliases.396 ///397 /// Examples:398 /// {n} --changed-before '2018-10-27 10:00:00'399 /// {n} --change-older-than 2weeks400 /// {n} --older 2018-10-27401 #[arg(402 long,403 alias("change-older-than"),404 alias("older"),405 value_name = "date|dur",371 long_help = "Filter results based on the file modification time. \372 Files with modification times less than the argument are returned. \373 The argument can be provided \374 as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \375 '--change-older-than' or '--older' can be used as aliases.\n\376 Examples:\n \377 --changed-before '2018-10-27 10:00:00'\n \378 --change-older-than 2weeks\n \379 --older 2018-10-27"406 help = "Filter by file modification time (older than)",407 long_help408 )]409 pub changed_before: Option<String>,410383 /// Filter by owning user and/or group411 /// Filter files by their user and/or group.412 /// Format: [(user|uid)][:(group|gid)]. Either side is optional.413 /// Precede either side with a '!' to exclude files instead.414 ///415 /// Examples:416 /// {n} --owner john417 /// {n} --owner :students418 /// {n} --owner '!john:students'419 #[cfg(unix)]420 #[arg(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group",386 long_help = "Filter files by their user and/or group. \387 Format: [(user|uid)][:(group|gid)]. Either side is optional. \388 Precede either side with a '!' to exclude files instead.\n\389 Examples:\n \390 --owner john\n \391 --owner :students\n \392 --owner '!john:students'"421 help = "Filter by owning user and/or group",422 long_help,423 )]424 pub owner: Option<OwnerFilter>,425426 #[command(flatten)]427 pub exec: Exec,428399 /// Max number of arguments to run as a batch size with -X429 /// Maximum number of arguments to pass to the command given with -X.430 /// If the number of results is greater than the given size,431 /// the command given with -X is run again with remaining arguments.432 /// A batch size of zero means there is no limit (default), but note433 /// that batching might still happen due to OS restrictions on the434 /// maximum length of command lines.435 #[arg(436 long,437 value_name = "size",438 hide_short_help = true,439 requires("exec_batch"),440 value_parser = value_parser!(usize),441 default_value_t,407 long_help = "Maximum number of arguments to pass to the command given with -X. \408 If the number of results is greater than the given size, \409 the command given with -X is run again with remaining arguments. \410 A batch size of zero means there is no limit (default), but note \411 that batching might still happen due to OS restrictions on the \412 maximum length of command lines.",442 help = "Max number of arguments to run as a batch size with -X",443 long_help,444 )]445 pub batch_size: usize,446416 /// Add a custom ignore-file in '.gitignore' format447 /// Add a custom ignore-file in '.gitignore' format. These files have a low precedence.448 #[arg(449 long,450 value_name = "path",451 hide_short_help = true,421 long_help = "Add a custom ignore-file in '.gitignore' format. These files have a low precedence."452 help = "Add a custom ignore-file in '.gitignore' format",453 long_help454 )]455 pub ignore_file: Vec<PathBuf>,456425 /// When to use colors457 /// Declare when to use color for the pattern match output458 #[arg(459 long,460 short = 'c',461 value_enum,462 default_value_t = ColorWhen::Auto,463 value_name = "when",432 long_help = "Declare when to use color for the pattern match output",464 help = "When to use colors",465 long_help,466 )]467 pub color: ColorWhen,468469 /// Set number of threads to use for searching & executing (default: number
7 unmodified lines
477 /// results to the console.478 #[arg(long, hide = true, value_parser = parse_millis)]479 pub max_buffer_time: Option<Duration>,480448 /// Limit number of search results481 ///Limit the number of search results to 'count' and quit immediately.482 #[arg(483 long,484 value_name = "count",485 hide_short_help = true,453 long_help = "Limit the number of search results to 'count' and quit immediately."486 help = "Limit the number of search results",487 long_help488 )]489 max_results: Option<usize>,490457 /// Limit search to a single result491 /// Limit the search to a single result and quit immediately.492 /// This is an alias for '--max-results=1'.493 #[arg(494 short = '1',495 hide_short_help = true,496 overrides_with("max_results"),462 long_help = "Limit the search to a single result and quit immediately. \463 This is an alias for '--max-results=1'."497 help = "Limit search to a single result",498 long_help499 )]500 max_one_result: bool,501467 /// Print nothing, exit code 0 if match found, 1 otherwise502 /// When the flag is present, the program does not print anything and will503 /// return with an exit code of 0 if there is at least one match. Otherwise, the504 /// exit code will be 1.505 /// '--has-results' can be used as an alias.506 #[arg(507 long,508 short = 'q',509 alias = "has-results",510 hide_short_help = true,511 conflicts_with("max_results"),474 long_help = "When the flag is present, the program does not print anything and will \475 return with an exit code of 0 if there is at least one match. Otherwise, the \476 exit code will be 1. \477 '--has-results' can be used as an alias."512 help = "Print nothing, exit code 0 if match found, 1 otherwise",513 long_help514 )]515 pub quiet: bool,516481 /// Show filesystem errors517 /// Enable the display of filesystem errors for situations such as518 /// insufficient permissions or dead symlinks.519 #[arg(520 long,521 hide_short_help = true,485 long_help = "Enable the display of filesystem errors for situations such as \486 insufficient permissions or dead symlinks."522 help = "Show filesystem errors",523 long_help524 )]525 pub show_errors: bool,526490 /// Change current working directory527 /// Change the current working directory of fd to the provided path. This528 /// means that search results will be shown with respect to the given base529 /// path. Note that relative paths which are passed to fd via the positional530 /// <path> argument or the '--search-path' option will also be resolved531 /// relative to this directory.532 #[arg(533 long,534 value_name = "path",535 hide_short_help = true,495 long_help = "Change the current working directory of fd to the provided path. This \496 means that search results will be shown with respect to the given base \497 path. Note that relative paths which are passed to fd via the positional \498 <path> argument or the '--search-path' option will also be resolved \499 relative to this directory."536 help = "Change current working directory",537 long_help538 )]539 pub base_directory: Option<PathBuf>,540503 /// the search pattern (a regular expression, unless '--glob' is used; optional)541 /// the search pattern which is either a regular expression (default) or a glob542 /// pattern (if --glob is used). If no pattern has been specified, every entry543 /// is considered a match. If your pattern starts with a dash (-), make sure to544 /// pass '--' first, or it will be considered as a flag (fd -- '-foo').545 #[arg(546 default_value = "",547 hide_default_value = true,548 value_name = "pattern",508 long_help = "the search pattern which is either a regular expression (default) or a glob \509 pattern (if --glob is used). If no pattern has been specified, every entry \510 is considered a match. If your pattern starts with a dash (-), make sure to \511 pass '--' first, or it will be considered as a flag (fd -- '-foo')."549 help = "the search pattern (a regular expression, unless '--glob' is used; optional)",550 long_help551 )]552 pub pattern: String,553515 /// Set path separator when printing file paths554 /// Set the path separator to use when printing file paths. The default is555 /// the OS-specific separator ('/' on Unix, '\' on Windows).556 #[arg(557 long,558 value_name = "separator",559 hide_short_help = true,520 long_help = "Set the path separator to use when printing file paths. The default is \521 the OS-specific separator ('/' on Unix, '\\' on Windows)."560 help = "Set path separator when printing file paths",561 long_help562 )]563 pub path_separator: Option<String>,564525 /// the root directories for the filesystem search (optional)565 /// The directory where the filesystem search is rooted (optional). If566 /// omitted, search the current working directory.567 #[arg(action = ArgAction::Append,568 value_name = "path",528 long_help = "The directory where the filesystem search is rooted (optional). If \529 omitted, search the current working directory.",569 help = "the root directories for the filesystem search (optional)",570 long_help,571 )]572 path: Vec<PathBuf>,573533 /// Provides paths to search as an alternative to the positional <path> argument574 /// Provide paths to search as an alternative to the positional <path>575 /// argument. Changes the usage to `fd [OPTIONS] --search-path <path>576 /// --search-path <path2> [<pattern>]`577 #[arg(578 long,579 conflicts_with("path"),580 value_name = "search-path",581 hide_short_help = true,539 long_help = "Provide paths to search as an alternative to the positional <path> \540 argument. Changes the usage to `fd [OPTIONS] --search-path <path> \541 --search-path <path2> [<pattern>]`"582 help = "Provides paths to search as an alternative to the positional <path> argument",583 long_help584 )]585 search_path: Vec<PathBuf>,586587 /// By default, relative paths are prefixed with './' when -x/--exec,588 /// -X/--exec-batch, or -0/--print0 are given, to reduce the risk of a589 /// path starting with '-' being treated as a command line option. Use590 /// this flag to disable this behaviour.549 #[arg(long, conflicts_with_all(&["path", "search_path"]), hide_short_help = true,550 long_help = "By default, relative paths are prefixed with './' when -x/--exec, \551 -X/--exec-batch, or -0/--print0 are given, to reduce the risk of a \552 path starting with '-' being treated as a command line option. Use \553 this flag to disable this behaviour.",554 )]591 #[arg(long, conflicts_with_all(&["path", "search_path"]), hide_short_help = true, long_help)]592 pub strip_cwd_prefix: bool,593594 /// By default, fd will traverse the file system tree as far as other options595 /// dictate. With this flag, fd ensures that it does not descend into a596 /// different file system than the one it started in. Comparable to the -mount597 /// or -xdev filters of find(1).598 #[cfg(any(unix, windows))]558 #[arg(long, aliases(&["mount", "xdev"]), hide_short_help = true,559 long_help = "By default, fd will traverse the file system tree as far as other options \560 dictate. With this flag, fd ensures that it does not descend into a \561 different file system than the one it started in. Comparable to the -mount \562 or -xdev filters of find(1).")]599 #[arg(long, aliases(&["mount", "xdev"]), hide_short_help = true, long_help)]600 pub one_file_system: bool,601602 #[cfg(feature = "completions")]603 #[arg(long, hide = true, exclusive = true)]
236 unmodified lines