Skip to content
Myr

Add `--maxdepth` as hidden alias for `--max-depth`

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

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.

authored by Mahmoud Al-Qudsi · committed by David Peter · parent 2465cd1 · Browse files · 2 files+11 added−0 removed
This commit

State

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

Diff stats

2 files+11 added−0 removed

  • other:+11 added−0 removed

2 files+11 added−0 removed

modified:src/app.rs+10 added
68 unmodified lines
69 .arg(arg("follow").long("follow").short("L").alias("dereference"))70 .arg(arg("full-path").long("full-path").short("p"))71 .arg(arg("null_separator").long("print0").short("0"))72 .arg(arg("depth").long("max-depth").short("d").takes_value(true))73 // support --maxdepth as well, for compatibility with rg74 .arg(75 arg("rg-depth")76 .long("maxdepth")77 .hidden(true)78 .takes_value(true),79 ).arg(80 arg("file-type")81 .long("type")82 .short("t")83 .multiple(true)
118 unmodified lines
202 doc!(h, "depth"203 , "Set maximum search depth (default: none)"204 , "Limit the directory traversal to a given depth. By default, there is no limit \205 on the search depth.");206 doc!(h, "rg-depth"207 , "Set maximum search depth (default: none)"208 , "Limit the directory traversal to a given depth. By default, there is no limit \209 on the search depth.");210 doc!(h, "file-type"211 , "Filter by type: file (f), directory (d), symlink (l),\nexecutable (x), empty (e)"212 , "Filter the search by type (multiple allowable filetypes can be specified):\n \213 'f' or 'file': regular files\n \
69 unmodified lines
modified:src/main.rs+1 added
156 unmodified lines
157 follow_links: matches.is_present("follow"),158 null_separator: matches.is_present("null_separator"),159 max_depth: matches160 .value_of("depth")161 .or_else(|| matches.value_of("rg-depth"))162 .and_then(|n| usize::from_str_radix(n, 10).ok()),163 threads: std::cmp::max(164 matches165 .value_of("threads")
74 unmodified lines