mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-17 17:35:16 +01:00
Add --maxdepth
as hidden alias for --max-depth
For muscle memory compatibility with `rg`. This variant will not show in the help or in the program options, and is only checked if `--maxdepth` is not specified.
This commit is contained in:
parent
2465cd1399
commit
d375b5e1f5
2 changed files with 11 additions and 0 deletions
10
src/app.rs
10
src/app.rs
|
@ -70,7 +70,13 @@ pub fn build_app() -> App<'static, 'static> {
|
||||||
.arg(arg("full-path").long("full-path").short("p"))
|
.arg(arg("full-path").long("full-path").short("p"))
|
||||||
.arg(arg("null_separator").long("print0").short("0"))
|
.arg(arg("null_separator").long("print0").short("0"))
|
||||||
.arg(arg("depth").long("max-depth").short("d").takes_value(true))
|
.arg(arg("depth").long("max-depth").short("d").takes_value(true))
|
||||||
|
// support --maxdepth as well, for compatibility with rg
|
||||||
.arg(
|
.arg(
|
||||||
|
arg("rg-depth")
|
||||||
|
.long("maxdepth")
|
||||||
|
.hidden(true)
|
||||||
|
.takes_value(true),
|
||||||
|
).arg(
|
||||||
arg("file-type")
|
arg("file-type")
|
||||||
.long("type")
|
.long("type")
|
||||||
.short("t")
|
.short("t")
|
||||||
|
@ -197,6 +203,10 @@ fn usage() -> HashMap<&'static str, Help> {
|
||||||
, "Set maximum search depth (default: none)"
|
, "Set maximum search depth (default: none)"
|
||||||
, "Limit the directory traversal to a given depth. By default, there is no limit \
|
, "Limit the directory traversal to a given depth. By default, there is no limit \
|
||||||
on the search depth.");
|
on the search depth.");
|
||||||
|
doc!(h, "rg-depth"
|
||||||
|
, "Set maximum search depth (default: none)"
|
||||||
|
, "Limit the directory traversal to a given depth. By default, there is no limit \
|
||||||
|
on the search depth.");
|
||||||
doc!(h, "file-type"
|
doc!(h, "file-type"
|
||||||
, "Filter by type: file (f), directory (d), symlink (l),\nexecutable (x), empty (e)"
|
, "Filter by type: file (f), directory (d), symlink (l),\nexecutable (x), empty (e)"
|
||||||
, "Filter the search by type (multiple allowable filetypes can be specified):\n \
|
, "Filter the search by type (multiple allowable filetypes can be specified):\n \
|
||||||
|
|
|
@ -158,6 +158,7 @@ fn main() {
|
||||||
null_separator: matches.is_present("null_separator"),
|
null_separator: matches.is_present("null_separator"),
|
||||||
max_depth: matches
|
max_depth: matches
|
||||||
.value_of("depth")
|
.value_of("depth")
|
||||||
|
.or_else(|| matches.value_of("rg-depth"))
|
||||||
.and_then(|n| usize::from_str_radix(n, 10).ok()),
|
.and_then(|n| usize::from_str_radix(n, 10).ok()),
|
||||||
threads: std::cmp::max(
|
threads: std::cmp::max(
|
||||||
matches
|
matches
|
||||||
|
|
Loading…
Reference in a new issue