mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-17 09:28:25 +01:00
Fix deprecations from clap 4.0
This commit is contained in:
parent
c0b14705cd
commit
c2115884de
1 changed files with 56 additions and 73 deletions
129
src/cli.rs
129
src/cli.rs
|
@ -82,9 +82,8 @@ impl clap::Args for Negations {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[clap(
|
#[command(
|
||||||
version,
|
version,
|
||||||
dont_collapse_args_in_usage = true,
|
|
||||||
after_help = "Note: `fd -h` prints a short and concise overview while `fd --help` gives all \
|
after_help = "Note: `fd -h` prints a short and concise overview while `fd --help` gives all \
|
||||||
details.",
|
details.",
|
||||||
after_long_help = "Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues",
|
after_long_help = "Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues",
|
||||||
|
@ -99,70 +98,70 @@ pub struct Opts {
|
||||||
/// hidden files and directories are skipped). Files and directories are considered
|
/// hidden files and directories are skipped). Files and directories are considered
|
||||||
/// to be hidden if their name starts with a `.` sign (dot).
|
/// to be hidden if their name starts with a `.` sign (dot).
|
||||||
/// The flag can be overridden with --no-hidden.
|
/// The flag can be overridden with --no-hidden.
|
||||||
#[clap(long, short = 'H', action)]
|
#[arg(long, short = 'H')]
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
/// Do not respect .(git|fd)ignore files
|
/// Do not respect .(git|fd)ignore files
|
||||||
///
|
///
|
||||||
/// Show search results from files and directories that would otherwise be
|
/// Show search results from files and directories that would otherwise be
|
||||||
/// ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.
|
/// ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.
|
||||||
/// The flag can be overridden with --ignore.
|
/// The flag can be overridden with --ignore.
|
||||||
#[clap(long, short = 'I', action)]
|
#[arg(long, short = 'I')]
|
||||||
pub no_ignore: bool,
|
pub no_ignore: bool,
|
||||||
/// Do not respect .gitignore files
|
/// Do not respect .gitignore files
|
||||||
///
|
///
|
||||||
///Show search results from files and directories that would otherwise be
|
///Show search results from files and directories that would otherwise be
|
||||||
///ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs.
|
///ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs.
|
||||||
#[clap(long, action, hide_short_help = true)]
|
#[arg(long, hide_short_help = true)]
|
||||||
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
|
||||||
///
|
///
|
||||||
/// Show search results from files and directories that would otherwise be
|
/// Show search results from files and directories that would otherwise be
|
||||||
/// ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories.
|
/// ignored by '.gitignore', '.ignore', or '.fdignore' files in parent directories.
|
||||||
#[clap(long, action, hide_short_help = true)]
|
#[arg(long, hide_short_help = true)]
|
||||||
pub no_ignore_parent: bool,
|
pub no_ignore_parent: bool,
|
||||||
/// Do not respect the global ignore file
|
/// Do not respect the global ignore file
|
||||||
#[clap(long, action, 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'
|
||||||
///
|
///
|
||||||
///Perform an unrestricted search, including ignored and hidden files. This is
|
///Perform an unrestricted search, including ignored and hidden files. This is
|
||||||
///an alias for '--no-ignore --hidden'.
|
///an alias for '--no-ignore --hidden'.
|
||||||
#[clap(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)]
|
||||||
rg_alias_hidden_ignore: u8,
|
rg_alias_hidden_ignore: u8,
|
||||||
/// Case-sensitive search (default: smart case)
|
/// Case-sensitive search (default: smart case)
|
||||||
///
|
///
|
||||||
///Perform a case-sensitive search. By default, fd uses case-insensitive
|
///Perform a case-sensitive search. By default, fd uses case-insensitive
|
||||||
///searches, unless the pattern contains an uppercase character (smart case).
|
///searches, unless the pattern contains an uppercase character (smart case).
|
||||||
#[clap(long, short = 's', action, overrides_with("ignore_case"))]
|
#[arg(long, short = 's', overrides_with("ignore_case"))]
|
||||||
pub case_sensitive: bool,
|
pub case_sensitive: bool,
|
||||||
/// Case-insensitive search (default: smart case)
|
/// Case-insensitive search (default: smart case)
|
||||||
///
|
///
|
||||||
/// Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless
|
/// Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless
|
||||||
/// the pattern contains an uppercase character (smart case).
|
/// the pattern contains an uppercase character (smart case).
|
||||||
#[clap(long, short = 'i', action, overrides_with("case_sensitive"))]
|
#[arg(long, short = 'i', overrides_with("case_sensitive"))]
|
||||||
pub ignore_case: bool,
|
pub ignore_case: bool,
|
||||||
/// Glob-based search (default: regular expression)
|
/// Glob-based search (default: regular expression)
|
||||||
///
|
///
|
||||||
/// Perform a glob-based search instead of a regular expression search.
|
/// Perform a glob-based search instead of a regular expression search.
|
||||||
#[clap(long, short = 'g', action, conflicts_with("fixed_strings"))]
|
#[arg(long, short = 'g', conflicts_with("fixed_strings"))]
|
||||||
pub glob: bool,
|
pub glob: bool,
|
||||||
/// Regular-expression based search (default)
|
/// Regular-expression based search (default)
|
||||||
///
|
///
|
||||||
///Perform a regular-expression based search (default). This can be used to override --glob.
|
///Perform a regular-expression based search (default). This can be used to override --glob.
|
||||||
#[clap(long, action, overrides_with("glob"), hide_short_help = true)]
|
#[arg(long, overrides_with("glob"), hide_short_help = true)]
|
||||||
pub regex: bool,
|
pub regex: bool,
|
||||||
/// Treat pattern as literal string instead of regex
|
/// Treat pattern as literal string instead of regex
|
||||||
///
|
///
|
||||||
/// Treat the pattern as a literal string instead of a regular expression. Note
|
/// Treat the pattern as a literal string instead of a regular expression. Note
|
||||||
/// that this also performs substring comparison. If you want to match on an
|
/// that this also performs substring comparison. If you want to match on an
|
||||||
/// exact filename, consider using '--glob'.
|
/// exact filename, consider using '--glob'.
|
||||||
#[clap(long, short = 'F', action, alias = "literal", hide_short_help = true)]
|
#[arg(long, short = 'F', alias = "literal", hide_short_help = true)]
|
||||||
pub fixed_strings: bool,
|
pub fixed_strings: bool,
|
||||||
/// Show absolute instead of relative paths
|
/// Show absolute instead of relative paths
|
||||||
///
|
///
|
||||||
/// Shows the full path starting with the root as opposed to relative paths.
|
/// Shows the full path starting with the root as opposed to relative paths.
|
||||||
/// The flag can be overridden with --relative-path.
|
/// The flag can be overridden with --relative-path.
|
||||||
#[clap(long, short = 'a', action)]
|
#[arg(long, short = 'a')]
|
||||||
pub absolute_path: bool,
|
pub absolute_path: bool,
|
||||||
/// Use a long listing format with file metadata
|
/// Use a long listing format with file metadata
|
||||||
///
|
///
|
||||||
|
@ -170,14 +169,14 @@ pub struct Opts {
|
||||||
/// for '--exec-batch ls -l' with some additional 'ls' options. This can be
|
/// for '--exec-batch ls -l' with some additional 'ls' options. This can be
|
||||||
/// used to see more metadata, to show symlink targets and to achieve a
|
/// used to see more metadata, to show symlink targets and to achieve a
|
||||||
/// deterministic sort order.
|
/// deterministic sort order.
|
||||||
#[clap(long, short = 'l', action, conflicts_with("absolute_path"))]
|
#[arg(long, short = 'l', conflicts_with("absolute_path"))]
|
||||||
pub list_details: bool,
|
pub list_details: bool,
|
||||||
/// Follow symbolic links
|
/// Follow symbolic links
|
||||||
///
|
///
|
||||||
/// By default, fd does not descend into symlinked directories. Using this
|
/// By default, fd does not descend into symlinked directories. Using this
|
||||||
/// flag, symbolic links are also traversed.
|
/// flag, symbolic links are also traversed.
|
||||||
/// Flag can be overridden with --no-follow.
|
/// Flag can be overridden with --no-follow.
|
||||||
#[clap(long, short = 'L', alias = "dereference", action)]
|
#[arg(long, short = 'L', alias = "dereference")]
|
||||||
pub follow: bool,
|
pub follow: bool,
|
||||||
/// Search full abs. path (default: filename only)
|
/// Search full abs. path (default: filename only)
|
||||||
///
|
///
|
||||||
|
@ -186,16 +185,15 @@ pub struct Opts {
|
||||||
/// (absolute) path.
|
/// (absolute) path.
|
||||||
/// Example:
|
/// Example:
|
||||||
/// fd --glob -p '**/.git/config'
|
/// fd --glob -p '**/.git/config'
|
||||||
#[clap(long, short = 'p', action, verbatim_doc_comment)]
|
#[arg(long, short = 'p', verbatim_doc_comment)]
|
||||||
pub full_path: bool,
|
pub full_path: bool,
|
||||||
/// Separate results by the null character
|
/// Separate results by the null character
|
||||||
///
|
///
|
||||||
/// Separate search results by the null character (instead of newlines).
|
/// Separate search results by the null character (instead of newlines).
|
||||||
/// Useful for piping results to 'xargs'.
|
/// Useful for piping results to 'xargs'.
|
||||||
#[clap(
|
#[arg(
|
||||||
long = "print0",
|
long = "print0",
|
||||||
short = '0',
|
short = '0',
|
||||||
action,
|
|
||||||
conflicts_with("list_details"),
|
conflicts_with("list_details"),
|
||||||
hide_short_help = true
|
hide_short_help = true
|
||||||
)]
|
)]
|
||||||
|
@ -204,31 +202,25 @@ pub struct Opts {
|
||||||
///
|
///
|
||||||
/// Limit the directory traversal to a given depth. By default, there is no
|
/// Limit the directory traversal to a given depth. By default, there is no
|
||||||
/// limit on the search depth.
|
/// limit on the search depth.
|
||||||
#[clap(
|
#[arg(long, short = 'd', value_name = "depth", alias("maxdepth"))]
|
||||||
long,
|
|
||||||
short = 'd',
|
|
||||||
value_name = "depth",
|
|
||||||
value_parser,
|
|
||||||
alias("maxdepth")
|
|
||||||
)]
|
|
||||||
max_depth: Option<usize>,
|
max_depth: Option<usize>,
|
||||||
/// Only show results starting at given depth
|
/// Only show results starting at given depth
|
||||||
///
|
///
|
||||||
/// Only show search results starting at the given depth.
|
/// Only show search results starting at the given depth.
|
||||||
/// See also: '--max-depth' and '--exact-depth'
|
/// See also: '--max-depth' and '--exact-depth'
|
||||||
#[clap(long, value_name = "depth", hide_short_help = true, value_parser)]
|
#[arg(long, value_name = "depth", hide_short_help = true)]
|
||||||
min_depth: Option<usize>,
|
min_depth: Option<usize>,
|
||||||
/// Only show results at exact given depth
|
/// Only show results at exact given depth
|
||||||
///
|
///
|
||||||
/// Only show search results at the exact given depth. This is an alias for
|
/// 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>'.
|
||||||
#[clap(long, value_name = "depth", hide_short_help = true, value_parser, conflicts_with_all(&["max_depth", "min_depth"]))]
|
#[arg(long, value_name = "depth", hide_short_help = true, conflicts_with_all(&["max_depth", "min_depth"]))]
|
||||||
exact_depth: Option<usize>,
|
exact_depth: Option<usize>,
|
||||||
/// Do not travers into matching directories
|
/// Do not travers into matching directories
|
||||||
///
|
///
|
||||||
/// 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.
|
||||||
#[clap(long, hide_short_help = true, action, conflicts_with_all(&["size", "exact_depth"]))]
|
#[arg(long, hide_short_help = true, conflicts_with_all(&["size", "exact_depth"]))]
|
||||||
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)
|
||||||
|
@ -268,10 +260,9 @@ pub struct Opts {
|
||||||
/// - Find empty directories:
|
/// - Find empty directories:
|
||||||
/// fd --type empty --type directory
|
/// fd --type empty --type directory
|
||||||
/// fd -te -td"
|
/// fd -te -td"
|
||||||
#[clap(
|
#[arg(
|
||||||
long = "type",
|
long = "type",
|
||||||
short = 't',
|
short = 't',
|
||||||
action,
|
|
||||||
value_name = "filetype",
|
value_name = "filetype",
|
||||||
hide_possible_values = true,
|
hide_possible_values = true,
|
||||||
value_enum,
|
value_enum,
|
||||||
|
@ -284,10 +275,10 @@ pub struct Opts {
|
||||||
/// allowable file extensions can be specified.
|
/// allowable file extensions can be specified.
|
||||||
/// If you want to search for files without extension,
|
/// If you want to search for files without extension,
|
||||||
/// you can use the regex '^[^.]+$' as a normal search pattern.
|
/// you can use the regex '^[^.]+$' as a normal search pattern.
|
||||||
#[clap(long = "extension", short = 'e', value_name = "ext", action)]
|
#[arg(long = "extension", short = 'e', value_name = "ext")]
|
||||||
pub extensions: Option<Vec<String>>,
|
pub extensions: Option<Vec<String>>,
|
||||||
|
|
||||||
#[clap(flatten)]
|
#[command(flatten)]
|
||||||
pub exec: Exec,
|
pub exec: Exec,
|
||||||
|
|
||||||
/// Max number of arguments to run as a batch with -X
|
/// Max number of arguments to run as a batch with -X
|
||||||
|
@ -298,7 +289,7 @@ pub struct Opts {
|
||||||
/// A batch size of zero means there is no limit (default), but note
|
/// A batch size of zero means there is no limit (default), but note
|
||||||
/// that batching might still happen due to OS restrictions on the
|
/// that batching might still happen due to OS restrictions on the
|
||||||
/// maximum length of command lines.
|
/// maximum length of command lines.
|
||||||
#[clap(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
value_name = "size",
|
value_name = "size",
|
||||||
hide_short_help = true,
|
hide_short_help = true,
|
||||||
|
@ -315,20 +306,20 @@ pub struct Opts {
|
||||||
/// Examples:
|
/// Examples:
|
||||||
/// --exclude '*.pyc'
|
/// --exclude '*.pyc'
|
||||||
/// --exclude node_modules
|
/// --exclude node_modules
|
||||||
#[clap(long, short = 'E', value_name = "pattern", verbatim_doc_comment)]
|
#[arg(long, short = 'E', value_name = "pattern", verbatim_doc_comment)]
|
||||||
pub exclude: Vec<String>,
|
pub exclude: Vec<String>,
|
||||||
/// Add custom ignore-file in '.gitignore' format
|
/// Add custom ignore-file in '.gitignore' format
|
||||||
///
|
///
|
||||||
/// Add a custom ignore-file in '.gitignore' format. These files have a low
|
/// Add a custom ignore-file in '.gitignore' format. These files have a low
|
||||||
/// precedence.
|
/// precedence.
|
||||||
#[clap(long, value_name = "path", action, hide_short_help = true)]
|
#[arg(long, value_name = "path", hide_short_help = true)]
|
||||||
pub ignore_file: Vec<PathBuf>,
|
pub ignore_file: Vec<PathBuf>,
|
||||||
/// When to use colors
|
/// When to use colors
|
||||||
///
|
///
|
||||||
/// 'auto': show colors if the output goes to an interactive console (default)
|
/// 'auto': show colors if the output goes to an interactive console (default)
|
||||||
/// 'never': do not use colorized output
|
/// 'never': do not use colorized output
|
||||||
/// 'always': always use colorized output
|
/// 'always': always use colorized output
|
||||||
#[clap(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
short = 'c',
|
short = 'c',
|
||||||
value_enum,
|
value_enum,
|
||||||
|
@ -342,7 +333,7 @@ pub struct Opts {
|
||||||
///
|
///
|
||||||
/// 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)
|
||||||
#[clap(long, short = 'j', value_name = "num", hide_short_help = true, value_parser = RangedU64ValueParser::<usize>::from(1..))]
|
#[arg(long, short = 'j', value_name = "num", hide_short_help = true, value_parser = RangedU64ValueParser::<usize>::from(1..))]
|
||||||
pub threads: Option<usize>,
|
pub threads: Option<usize>,
|
||||||
/// Limit results based on the size of files
|
/// Limit results based on the size of files
|
||||||
///
|
///
|
||||||
|
@ -362,13 +353,13 @@ pub struct Opts {
|
||||||
/// 'mi': mebibytes
|
/// 'mi': mebibytes
|
||||||
/// 'gi': gibibytes
|
/// 'gi': gibibytes
|
||||||
/// 'ti': tebibytes
|
/// 'ti': tebibytes
|
||||||
#[clap(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, action, verbatim_doc_comment)]
|
#[arg(long, short = 'S', value_parser = SizeFilter::from_string, allow_hyphen_values = true, verbatim_doc_comment)]
|
||||||
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.
|
||||||
#[clap(long, hide = true, action, 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)
|
||||||
///
|
///
|
||||||
|
@ -380,13 +371,12 @@ pub struct Opts {
|
||||||
/// --changed-within 2weeks
|
/// --changed-within 2weeks
|
||||||
/// --change-newer-than '2018-10-27 10:00:00'
|
/// --change-newer-than '2018-10-27 10:00:00'
|
||||||
/// --newer 2018-10-27
|
/// --newer 2018-10-27
|
||||||
#[clap(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
alias("change-newer-than"),
|
alias("change-newer-than"),
|
||||||
alias("newer"),
|
alias("newer"),
|
||||||
value_name = "date|dur",
|
value_name = "date|dur",
|
||||||
verbatim_doc_comment,
|
verbatim_doc_comment
|
||||||
action
|
|
||||||
)]
|
)]
|
||||||
pub changed_within: Option<String>,
|
pub changed_within: Option<String>,
|
||||||
/// Filter by file modification time (older than)
|
/// Filter by file modification time (older than)
|
||||||
|
@ -399,29 +389,23 @@ pub struct Opts {
|
||||||
/// --changed-before '2018-10-27 10:00:00'
|
/// --changed-before '2018-10-27 10:00:00'
|
||||||
/// --change-older-than 2weeks
|
/// --change-older-than 2weeks
|
||||||
/// --older 2018-10-27
|
/// --older 2018-10-27
|
||||||
#[clap(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
alias("change-older-than"),
|
alias("change-older-than"),
|
||||||
alias("older"),
|
alias("older"),
|
||||||
value_name = "date|dur",
|
value_name = "date|dur",
|
||||||
verbatim_doc_comment,
|
verbatim_doc_comment
|
||||||
action
|
|
||||||
)]
|
)]
|
||||||
pub changed_before: Option<String>,
|
pub changed_before: Option<String>,
|
||||||
/// Limit number of search results
|
/// Limit number of search results
|
||||||
///
|
///
|
||||||
/// Limit the number of search results to 'count' and quit immediately.
|
/// Limit the number of search results to 'count' and quit immediately.
|
||||||
#[clap(long, value_name = "count", hide_short_help = true, value_parser)]
|
#[arg(long, value_name = "count", hide_short_help = true)]
|
||||||
max_results: Option<usize>,
|
max_results: Option<usize>,
|
||||||
/// Limit search to a single result and quit immediately
|
/// Limit search to a single result and quit immediately
|
||||||
///
|
///
|
||||||
/// This is an alias for '--max-results=1'.
|
/// This is an alias for '--max-results=1'.
|
||||||
#[clap(
|
#[arg(short = '1', hide_short_help = true, overrides_with("max_results"))]
|
||||||
short = '1',
|
|
||||||
hide_short_help = true,
|
|
||||||
overrides_with("max_results"),
|
|
||||||
action
|
|
||||||
)]
|
|
||||||
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
|
||||||
///
|
///
|
||||||
|
@ -430,20 +414,19 @@ pub struct Opts {
|
||||||
/// exit code will be 1.
|
/// exit code will be 1.
|
||||||
///
|
///
|
||||||
/// '--has-results' can be used as an alias.
|
/// '--has-results' can be used as an alias.
|
||||||
#[clap(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
short = 'q',
|
short = 'q',
|
||||||
alias = "has-results",
|
alias = "has-results",
|
||||||
hide_short_help = true,
|
hide_short_help = true,
|
||||||
conflicts_with("max_results"),
|
conflicts_with("max_results")
|
||||||
action
|
|
||||||
)]
|
)]
|
||||||
pub quiet: bool,
|
pub quiet: bool,
|
||||||
/// Show filesystem errors
|
/// Show filesystem errors
|
||||||
///
|
///
|
||||||
///Enable the display of filesystem errors for situations such as
|
///Enable the display of filesystem errors for situations such as
|
||||||
///insufficient permissions or dead symlinks.
|
///insufficient permissions or dead symlinks.
|
||||||
#[clap(long, hide_short_help = true, action)]
|
#[arg(long, hide_short_help = true)]
|
||||||
pub show_errors: bool,
|
pub show_errors: bool,
|
||||||
/// Change current working directory
|
/// Change current working directory
|
||||||
///
|
///
|
||||||
|
@ -452,7 +435,7 @@ pub struct Opts {
|
||||||
/// path. Note that relative paths which are passed to fd via the positional
|
/// path. Note that relative paths which are passed to fd via the positional
|
||||||
/// <path> argument or the '--search-path' option will also be resolved
|
/// <path> argument or the '--search-path' option will also be resolved
|
||||||
/// relative to this directory.
|
/// relative to this directory.
|
||||||
#[clap(long, value_name = "path", action, hide_short_help = true)]
|
#[arg(long, value_name = "path", hide_short_help = true)]
|
||||||
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)
|
||||||
///
|
///
|
||||||
|
@ -460,23 +443,23 @@ pub struct Opts {
|
||||||
/// pattern (if --glob is used). If no pattern has been specified, every entry
|
/// pattern (if --glob is used). If no pattern has been specified, every entry
|
||||||
/// is considered a match. If your pattern starts with a dash (-), make sure to
|
/// is considered a match. If your pattern starts with a dash (-), make sure to
|
||||||
/// pass '--' first, or it will be considered as a flag (fd -- '-foo').
|
/// pass '--' first, or it will be considered as a flag (fd -- '-foo').
|
||||||
#[clap(value_parser, default_value = "", hide_default_value = true)]
|
#[arg(default_value = "", hide_default_value = true)]
|
||||||
pub pattern: String,
|
pub pattern: String,
|
||||||
/// Set path separator when printing file paths
|
/// Set path separator when printing file paths
|
||||||
/// Set the path separator to use when printing file paths. The default is
|
/// Set the path separator to use when printing file paths. The default is
|
||||||
/// the OS-specific separator ('/' on Unix, '\\' on Windows).
|
/// the OS-specific separator ('/' on Unix, '\\' on Windows).
|
||||||
#[clap(long, value_name = "separator", hide_short_help = true, action)]
|
#[arg(long, value_name = "separator", hide_short_help = true)]
|
||||||
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)
|
||||||
///
|
///
|
||||||
/// The directories where the filesystem search is rooted.
|
/// The directories where the filesystem search is rooted.
|
||||||
/// If omitted, search the current working directory.
|
/// If omitted, search the current working directory.
|
||||||
#[clap(action = ArgAction::Append)]
|
#[arg(action = ArgAction::Append)]
|
||||||
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
|
||||||
///
|
///
|
||||||
/// Changes the usage to `fd [OPTIONS] --search-path <path> --search-path <path2> [<pattern>]`
|
/// Changes the usage to `fd [OPTIONS] --search-path <path> --search-path <path2> [<pattern>]`
|
||||||
#[clap(long, conflicts_with("path"), action, hide_short_help = true)]
|
#[arg(long, conflicts_with("path"), hide_short_help = true)]
|
||||||
search_path: Vec<PathBuf>,
|
search_path: Vec<PathBuf>,
|
||||||
/// strip './' prefix from -0/--print-0 output
|
/// strip './' prefix from -0/--print-0 output
|
||||||
///
|
///
|
||||||
|
@ -484,7 +467,7 @@ pub struct Opts {
|
||||||
/// -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
|
||||||
/// this flag to disable this behaviour.
|
/// this flag to disable this behaviour.
|
||||||
#[clap(long, conflicts_with_all(&["path", "search_path"]), hide_short_help = true, action)]
|
#[arg(long, conflicts_with_all(&["path", "search_path"]), hide_short_help = true)]
|
||||||
pub strip_cwd_prefix: bool,
|
pub strip_cwd_prefix: bool,
|
||||||
/// Filter by owning user and/or group
|
/// Filter by owning user and/or group
|
||||||
///
|
///
|
||||||
|
@ -496,7 +479,7 @@ pub struct Opts {
|
||||||
/// --owner :students
|
/// --owner :students
|
||||||
/// --owner '!john:students'
|
/// --owner '!john:students'
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[clap(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group", verbatim_doc_comment)]
|
#[arg(long, short = 'o', value_parser = OwnerFilter::from_string, value_name = "user:group", verbatim_doc_comment)]
|
||||||
pub owner: Option<OwnerFilter>,
|
pub owner: Option<OwnerFilter>,
|
||||||
/// Do not descend into a different file system
|
/// Do not descend into a different file system
|
||||||
///
|
///
|
||||||
|
@ -505,11 +488,11 @@ pub struct Opts {
|
||||||
/// different file system than the one it started in. Comparable to the -mount
|
/// different file system than the one it started in. Comparable to the -mount
|
||||||
/// or -xdev filters of find(1).
|
/// or -xdev filters of find(1).
|
||||||
#[cfg(any(unix, windows))]
|
#[cfg(any(unix, windows))]
|
||||||
#[clap(long, aliases(&["mount", "xdev"]), hide_short_help = true)]
|
#[arg(long, aliases(&["mount", "xdev"]), hide_short_help = true)]
|
||||||
pub one_file_system: bool,
|
pub one_file_system: bool,
|
||||||
|
|
||||||
#[cfg(feature = "completions")]
|
#[cfg(feature = "completions")]
|
||||||
#[clap(long, action, hide = true, exclusive = true)]
|
#[arg(long, hide = true, exclusive = true)]
|
||||||
gen_completions: Option<Option<Shell>>,
|
gen_completions: Option<Option<Shell>>,
|
||||||
|
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
|
@ -613,19 +596,19 @@ fn guess_shell() -> anyhow::Result<Shell> {
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, ValueEnum)]
|
#[derive(Copy, Clone, PartialEq, Eq, ValueEnum)]
|
||||||
pub enum FileType {
|
pub enum FileType {
|
||||||
#[clap(alias = "f")]
|
#[value(alias = "f")]
|
||||||
File,
|
File,
|
||||||
#[clap(alias = "d")]
|
#[value(alias = "d")]
|
||||||
Directory,
|
Directory,
|
||||||
#[clap(alias = "l")]
|
#[value(alias = "l")]
|
||||||
Symlink,
|
Symlink,
|
||||||
#[clap(alias = "x")]
|
#[value(alias = "x")]
|
||||||
Executable,
|
Executable,
|
||||||
#[clap(alias = "e")]
|
#[value(alias = "e")]
|
||||||
Empty,
|
Empty,
|
||||||
#[clap(alias = "s")]
|
#[value(alias = "s")]
|
||||||
Socket,
|
Socket,
|
||||||
#[clap(alias = "p")]
|
#[value(alias = "p")]
|
||||||
Pipe,
|
Pipe,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue