mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-17 17:35:16 +01:00
Add newlines between options
This commit is contained in:
parent
55029e889e
commit
5771e74b95
1 changed files with 40 additions and 0 deletions
40
src/cli.rs
40
src/cli.rs
|
@ -100,6 +100,7 @@ pub struct Opts {
|
||||||
The flag can be overridden with --no-hidden."
|
The flag can be overridden with --no-hidden."
|
||||||
)]
|
)]
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
|
|
||||||
/// Do not respect .(git|fd)ignore files
|
/// Do not respect .(git|fd)ignore files
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -109,6 +110,7 @@ pub struct Opts {
|
||||||
The flag can be overridden with --ignore."
|
The flag can be overridden with --ignore."
|
||||||
)]
|
)]
|
||||||
pub no_ignore: bool,
|
pub no_ignore: bool,
|
||||||
|
|
||||||
/// Do not respect .gitignore files
|
/// Do not respect .gitignore files
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -117,6 +119,7 @@ pub struct Opts {
|
||||||
ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs."
|
ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs."
|
||||||
)]
|
)]
|
||||||
pub no_ignore_vcs: bool,
|
pub no_ignore_vcs: bool,
|
||||||
|
|
||||||
/// Do not respect .(git|fd)ignore files in parent directories
|
/// Do not respect .(git|fd)ignore files in parent directories
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -125,15 +128,18 @@ pub struct Opts {
|
||||||
ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories."
|
ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories."
|
||||||
)]
|
)]
|
||||||
pub no_ignore_parent: bool,
|
pub no_ignore_parent: bool,
|
||||||
|
|
||||||
/// Do not respect the global ignore file
|
/// Do not respect the global ignore file
|
||||||
#[arg(long, hide = true)]
|
#[arg(long, hide = true)]
|
||||||
pub no_global_ignore_file: bool,
|
pub no_global_ignore_file: bool,
|
||||||
|
|
||||||
/// Unrestricted search, alias for '--no-ignore --hidden'
|
/// Unrestricted search, alias for '--no-ignore --hidden'
|
||||||
#[arg(long = "unrestricted", short = 'u', overrides_with_all(&["ignore", "no_hidden"]), action(ArgAction::Count), hide_short_help = true,
|
#[arg(long = "unrestricted", short = 'u', overrides_with_all(&["ignore", "no_hidden"]), action(ArgAction::Count), hide_short_help = true,
|
||||||
long_help = "Perform an unrestricted search, including ignored and hidden files. This is \
|
long_help = "Perform an unrestricted search, including ignored and hidden files. This is \
|
||||||
an alias for '--no-ignore --hidden'."
|
an alias for '--no-ignore --hidden'."
|
||||||
)]
|
)]
|
||||||
rg_alias_hidden_ignore: u8,
|
rg_alias_hidden_ignore: u8,
|
||||||
|
|
||||||
/// Case-sensitive search (default: smart case)
|
/// Case-sensitive search (default: smart case)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -144,6 +150,7 @@ pub struct Opts {
|
||||||
case)."
|
case)."
|
||||||
)]
|
)]
|
||||||
pub case_sensitive: bool,
|
pub case_sensitive: bool,
|
||||||
|
|
||||||
/// Case-insensitive search (default: smart case)
|
/// Case-insensitive search (default: smart case)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -154,6 +161,7 @@ pub struct Opts {
|
||||||
case)."
|
case)."
|
||||||
)]
|
)]
|
||||||
pub ignore_case: bool,
|
pub ignore_case: bool,
|
||||||
|
|
||||||
/// Glob-based search (default: regular expression)
|
/// Glob-based search (default: regular expression)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -162,6 +170,7 @@ pub struct Opts {
|
||||||
long_help = "Perform a glob-based search instead of a regular expression search."
|
long_help = "Perform a glob-based search instead of a regular expression search."
|
||||||
)]
|
)]
|
||||||
pub glob: bool,
|
pub glob: bool,
|
||||||
|
|
||||||
/// Regular-expression based search (default)
|
/// Regular-expression based search (default)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -171,6 +180,7 @@ pub struct Opts {
|
||||||
override --glob."
|
override --glob."
|
||||||
)]
|
)]
|
||||||
pub regex: bool,
|
pub regex: bool,
|
||||||
|
|
||||||
/// Treat pattern as literal string stead of regex
|
/// Treat pattern as literal string stead of regex
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -182,6 +192,7 @@ pub struct Opts {
|
||||||
exact filename, consider using '--glob'."
|
exact filename, consider using '--glob'."
|
||||||
)]
|
)]
|
||||||
pub fixed_strings: bool,
|
pub fixed_strings: bool,
|
||||||
|
|
||||||
/// Show absolute instead of relative paths
|
/// Show absolute instead of relative paths
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -190,6 +201,7 @@ pub struct Opts {
|
||||||
The flag can be overridden with --relative-path."
|
The flag can be overridden with --relative-path."
|
||||||
)]
|
)]
|
||||||
pub absolute_path: bool,
|
pub absolute_path: bool,
|
||||||
|
|
||||||
/// Use a long listing format with file metadata
|
/// Use a long listing format with file metadata
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -201,6 +213,7 @@ pub struct Opts {
|
||||||
deterministic sort order."
|
deterministic sort order."
|
||||||
)]
|
)]
|
||||||
pub list_details: bool,
|
pub list_details: bool,
|
||||||
|
|
||||||
/// Follow symbolic links
|
/// Follow symbolic links
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -211,6 +224,7 @@ pub struct Opts {
|
||||||
Flag can be overriden with --no-follow."
|
Flag can be overriden with --no-follow."
|
||||||
)]
|
)]
|
||||||
pub follow: bool,
|
pub follow: bool,
|
||||||
|
|
||||||
/// Search full abs. path (default: filename only)
|
/// Search full abs. path (default: filename only)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -221,6 +235,7 @@ pub struct Opts {
|
||||||
fd --glob -p '**/.git/config'"
|
fd --glob -p '**/.git/config'"
|
||||||
)]
|
)]
|
||||||
pub full_path: bool,
|
pub full_path: bool,
|
||||||
|
|
||||||
/// Separate search results by the null character
|
/// Separate search results by the null character
|
||||||
#[arg(
|
#[arg(
|
||||||
long = "print0",
|
long = "print0",
|
||||||
|
@ -231,6 +246,7 @@ pub struct Opts {
|
||||||
Useful for piping results to 'xargs'."
|
Useful for piping results to 'xargs'."
|
||||||
)]
|
)]
|
||||||
pub null_separator: bool,
|
pub null_separator: bool,
|
||||||
|
|
||||||
/// Set maximum search depth (default: none)
|
/// Set maximum search depth (default: none)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -241,6 +257,7 @@ pub struct Opts {
|
||||||
limit on the search depth."
|
limit on the search depth."
|
||||||
)]
|
)]
|
||||||
max_depth: Option<usize>,
|
max_depth: Option<usize>,
|
||||||
|
|
||||||
/// Only show search results starting at the given depth.
|
/// Only show search results starting at the given depth.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -250,12 +267,14 @@ pub struct Opts {
|
||||||
See also: '--max-depth' and '--exact-depth'"
|
See also: '--max-depth' and '--exact-depth'"
|
||||||
)]
|
)]
|
||||||
min_depth: Option<usize>,
|
min_depth: Option<usize>,
|
||||||
|
|
||||||
/// Only show search results at the exact given depth
|
/// Only show search results at the exact given depth
|
||||||
#[arg(long, value_name = "depth", hide_short_help = true, conflicts_with_all(&["max_depth", "min_depth"]),
|
#[arg(long, value_name = "depth", hide_short_help = true, conflicts_with_all(&["max_depth", "min_depth"]),
|
||||||
long_help = "Only show search results at the exact given depth. This is an alias for \
|
long_help = "Only show search results at the exact given depth. This is an alias for \
|
||||||
'--min-depth <depth> --max-depth <depth>'.",
|
'--min-depth <depth> --max-depth <depth>'.",
|
||||||
)]
|
)]
|
||||||
exact_depth: Option<usize>,
|
exact_depth: Option<usize>,
|
||||||
|
|
||||||
/// Do not traverse into directories that match the search criteria. If
|
/// Do not traverse into directories that match the search criteria. If
|
||||||
/// you want to exclude specific directories, use the '--exclude=…' option.
|
/// you want to exclude specific directories, use the '--exclude=…' option.
|
||||||
#[arg(long, hide_short_help = true, conflicts_with_all(&["size", "exact_depth"]),
|
#[arg(long, hide_short_help = true, conflicts_with_all(&["size", "exact_depth"]),
|
||||||
|
@ -263,6 +282,7 @@ pub struct Opts {
|
||||||
you want to exclude specific directories, use the '--exclude=…' option.",
|
you want to exclude specific directories, use the '--exclude=…' option.",
|
||||||
)]
|
)]
|
||||||
pub prune: bool,
|
pub prune: bool,
|
||||||
|
|
||||||
/// Filter by type: file (f), directory (d), symlink (l),
|
/// Filter by type: file (f), directory (d), symlink (l),
|
||||||
/// executable (x), empty (e), socket (s), pipe (p)
|
/// executable (x), empty (e), socket (s), pipe (p)
|
||||||
#[arg(
|
#[arg(
|
||||||
|
@ -303,6 +323,7 @@ pub struct Opts {
|
||||||
fd -te -td"
|
fd -te -td"
|
||||||
)]
|
)]
|
||||||
pub filetype: Option<Vec<FileType>>,
|
pub filetype: Option<Vec<FileType>>,
|
||||||
|
|
||||||
/// Filter by file extension
|
/// Filter by file extension
|
||||||
#[arg(
|
#[arg(
|
||||||
long = "extension",
|
long = "extension",
|
||||||
|
@ -334,6 +355,7 @@ pub struct Opts {
|
||||||
maximum length of command lines.",
|
maximum length of command lines.",
|
||||||
)]
|
)]
|
||||||
pub batch_size: usize,
|
pub batch_size: usize,
|
||||||
|
|
||||||
/// Exclude entries that match the given glob pattern
|
/// Exclude entries that match the given glob pattern
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -347,6 +369,7 @@ pub struct Opts {
|
||||||
--exclude node_modules"
|
--exclude node_modules"
|
||||||
)]
|
)]
|
||||||
pub exclude: Vec<String>,
|
pub exclude: Vec<String>,
|
||||||
|
|
||||||
/// Add a custom ignore-file in '.gitignore' format
|
/// Add a custom ignore-file in '.gitignore' format
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -355,6 +378,7 @@ pub struct Opts {
|
||||||
long_help = "Add a custom ignore-file in '.gitignore' format. These files have a low precedence."
|
long_help = "Add a custom ignore-file in '.gitignore' format. These files have a low precedence."
|
||||||
)]
|
)]
|
||||||
pub ignore_file: Vec<PathBuf>,
|
pub ignore_file: Vec<PathBuf>,
|
||||||
|
|
||||||
/// When to use colors
|
/// When to use colors
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -365,10 +389,12 @@ pub struct Opts {
|
||||||
long_help = "Declare when to use color for the pattern match output",
|
long_help = "Declare when to use color for the pattern match output",
|
||||||
)]
|
)]
|
||||||
pub color: ColorWhen,
|
pub color: ColorWhen,
|
||||||
|
|
||||||
/// Set number of threads to use for searching & executing (default: number
|
/// Set number of threads to use for searching & executing (default: number
|
||||||
/// of available CPU cores)
|
/// of available CPU cores)
|
||||||
#[arg(long, short = 'j', value_name = "num", hide_short_help = true, value_parser = 1..)]
|
#[arg(long, short = 'j', value_name = "num", hide_short_help = true, value_parser = 1..)]
|
||||||
pub threads: Option<u32>,
|
pub threads: Option<u32>,
|
||||||
|
|
||||||
/// Limit results based on the size of files
|
/// Limit results based on the size of files
|
||||||
#[arg(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, verbatim_doc_comment, value_name = "size",
|
#[arg(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, verbatim_doc_comment, value_name = "size",
|
||||||
long_help = "Limit results based on the size of files using the format <+-><NUM><UNIT>.\n \
|
long_help = "Limit results based on the size of files using the format <+-><NUM><UNIT>.\n \
|
||||||
|
@ -389,12 +415,14 @@ pub struct Opts {
|
||||||
'ti': tebibytes",
|
'ti': tebibytes",
|
||||||
)]
|
)]
|
||||||
pub size: Vec<SizeFilter>,
|
pub size: Vec<SizeFilter>,
|
||||||
|
|
||||||
/// Milliseconds to buffer before streaming search results to console
|
/// Milliseconds to buffer before streaming search results to console
|
||||||
///
|
///
|
||||||
/// Amount of time in milliseconds to buffer, before streaming the search
|
/// Amount of time in milliseconds to buffer, before streaming the search
|
||||||
/// results to the console.
|
/// results to the console.
|
||||||
#[arg(long, hide = true, value_parser = parse_millis)]
|
#[arg(long, hide = true, value_parser = parse_millis)]
|
||||||
pub max_buffer_time: Option<Duration>,
|
pub max_buffer_time: Option<Duration>,
|
||||||
|
|
||||||
/// Filter by file modification time (newer than)
|
/// Filter by file modification time (newer than)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -411,6 +439,7 @@ pub struct Opts {
|
||||||
--newer 2018-10-27"
|
--newer 2018-10-27"
|
||||||
)]
|
)]
|
||||||
pub changed_within: Option<String>,
|
pub changed_within: Option<String>,
|
||||||
|
|
||||||
/// Filter by file modification time (older than)
|
/// Filter by file modification time (older than)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -426,6 +455,7 @@ pub struct Opts {
|
||||||
--older 2018-10-27"
|
--older 2018-10-27"
|
||||||
)]
|
)]
|
||||||
pub changed_before: Option<String>,
|
pub changed_before: Option<String>,
|
||||||
|
|
||||||
/// Limit number of search results
|
/// Limit number of search results
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -434,6 +464,7 @@ pub struct Opts {
|
||||||
long_help = "Limit the number of search results to 'count' and quit immediately."
|
long_help = "Limit the number of search results to 'count' and quit immediately."
|
||||||
)]
|
)]
|
||||||
max_results: Option<usize>,
|
max_results: Option<usize>,
|
||||||
|
|
||||||
/// Limit search to a single result
|
/// Limit search to a single result
|
||||||
#[arg(
|
#[arg(
|
||||||
short = '1',
|
short = '1',
|
||||||
|
@ -443,6 +474,7 @@ pub struct Opts {
|
||||||
This is an alias for '--max-results=1'."
|
This is an alias for '--max-results=1'."
|
||||||
)]
|
)]
|
||||||
max_one_result: bool,
|
max_one_result: bool,
|
||||||
|
|
||||||
/// Print nothing, exit code 0 if match found, 1 otherwise
|
/// Print nothing, exit code 0 if match found, 1 otherwise
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -456,6 +488,7 @@ pub struct Opts {
|
||||||
'--has-results' can be used as an alias."
|
'--has-results' can be used as an alias."
|
||||||
)]
|
)]
|
||||||
pub quiet: bool,
|
pub quiet: bool,
|
||||||
|
|
||||||
/// Show filesystem errors
|
/// Show filesystem errors
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -464,6 +497,7 @@ pub struct Opts {
|
||||||
insufficient permissions or dead symlinks."
|
insufficient permissions or dead symlinks."
|
||||||
)]
|
)]
|
||||||
pub show_errors: bool,
|
pub show_errors: bool,
|
||||||
|
|
||||||
/// Change current working directory
|
/// Change current working directory
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -476,6 +510,7 @@ pub struct Opts {
|
||||||
relative to this directory."
|
relative to this directory."
|
||||||
)]
|
)]
|
||||||
pub base_directory: Option<PathBuf>,
|
pub base_directory: Option<PathBuf>,
|
||||||
|
|
||||||
/// the search pattern (a regular expression, unless '--glob' is used; optional)
|
/// the search pattern (a regular expression, unless '--glob' is used; optional)
|
||||||
#[arg(
|
#[arg(
|
||||||
default_value = "",
|
default_value = "",
|
||||||
|
@ -487,6 +522,7 @@ pub struct Opts {
|
||||||
pass '--' first, or it will be considered as a flag (fd -- '-foo')."
|
pass '--' first, or it will be considered as a flag (fd -- '-foo')."
|
||||||
)]
|
)]
|
||||||
pub pattern: String,
|
pub pattern: String,
|
||||||
|
|
||||||
/// Set path separator when printing file paths
|
/// Set path separator when printing file paths
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -496,6 +532,7 @@ pub struct Opts {
|
||||||
the OS-specific separator ('/' on Unix, '\\' on Windows)."
|
the OS-specific separator ('/' on Unix, '\\' on Windows)."
|
||||||
)]
|
)]
|
||||||
pub path_separator: Option<String>,
|
pub path_separator: Option<String>,
|
||||||
|
|
||||||
/// the root directories for the filesystem search (optional)
|
/// the root directories for the filesystem search (optional)
|
||||||
#[arg(action = ArgAction::Append,
|
#[arg(action = ArgAction::Append,
|
||||||
value_name = "path",
|
value_name = "path",
|
||||||
|
@ -503,6 +540,7 @@ pub struct Opts {
|
||||||
omitted, search the current working directory.",
|
omitted, search the current working directory.",
|
||||||
)]
|
)]
|
||||||
path: Vec<PathBuf>,
|
path: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Provides paths to search as an alternative to the positional <path> argument
|
/// Provides paths to search as an alternative to the positional <path> argument
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -514,6 +552,7 @@ pub struct Opts {
|
||||||
--search-path <path2> [<pattern>]`"
|
--search-path <path2> [<pattern>]`"
|
||||||
)]
|
)]
|
||||||
search_path: Vec<PathBuf>,
|
search_path: Vec<PathBuf>,
|
||||||
|
|
||||||
/// By default, relative paths are prefixed with './' when -x/--exec,
|
/// By default, relative paths are prefixed with './' when -x/--exec,
|
||||||
/// -X/--exec-batch, or -0/--print0 are given, to reduce the risk of a
|
/// -X/--exec-batch, or -0/--print0 are given, to reduce the risk of a
|
||||||
/// path starting with '-' being treated as a command line option. Use
|
/// path starting with '-' being treated as a command line option. Use
|
||||||
|
@ -525,6 +564,7 @@ pub struct Opts {
|
||||||
this flag to disable this behaviour.",
|
this flag to disable this behaviour.",
|
||||||
)]
|
)]
|
||||||
pub strip_cwd_prefix: bool,
|
pub strip_cwd_prefix: bool,
|
||||||
|
|
||||||
/// Filter by owning user and/or group
|
/// Filter by owning user and/or group
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[arg(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group",
|
#[arg(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group",
|
||||||
|
|
Loading…
Reference in a new issue