Skip to content
Myr

cli: make -d a short flag for --max-depth

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

Interestingly, ripgrep now only has two available ASCII letter short flags remaining: -k and -y. Closes #2643, Closes #2644

authored by Andrew Gallant · committed by Andrew Gallant · parent 3d2f49f · Browse files · 3 files+9 added−1 removed
This commit

State

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

Diff stats

3 files+9 added−1 removed

  • other:+9 added−1 removed

3 files+9 added−1 removed

modified:crates/core/flags/complete/rg.zsh+1 added-1 removed
190 unmodified lines
191 '--max-columns-preview[show preview for long lines (with -M)]'192 $no"--no-max-columns-preview[don't show preview for long lines (with -M)]"193194 + '(max-depth)' # Directory-depth options195 '--max-depth=[specify max number of directories to descend]:number of directories'195 {-d,--max-depth}'[specify max number of directories to descend]:number of directories'196 '--maxdepth=[alias for --max-depth]:number of directories'197 '!--maxdepth=:number of directories'198199 + '(messages)' # Error-message options
462 unmodified lines
modified:crates/core/flags/defs.rs+6 added
3827 unmodified lines
3828impl Flag for MaxDepth {3829 fn is_switch(&self) -> bool {3830 false3831 }3832 fn name_short(&self) -> Option<u8> {3833 Some(b'd')3834 }3835 fn name_long(&self) -> &'static str {3836 "max-depth"3837 }3838 fn aliases(&self) -> &'static [&'static str] {
36 unmodified lines
38753876 let args = parse_low_raw(["--max-depth", "5"]).unwrap();3877 assert_eq!(Some(5), args.max_depth);38783879 let args = parse_low_raw(["-d", "5"]).unwrap();3880 assert_eq!(Some(5), args.max_depth);38813882 let args = parse_low_raw(["--max-depth", "5", "--max-depth=10"]).unwrap();3883 assert_eq!(Some(10), args.max_depth);38843885 let args = parse_low_raw(["--max-depth", "0"]).unwrap();
3746 unmodified lines
modified:CHANGELOG.md+2 added
34 unmodified lines
35* [FEATURE #2195](https://github.com/BurntSushi/ripgrep/issues/2195):36 When `extra-verbose` mode is enabled in zsh, show extra file type info.37* [FEATURE #2409](https://github.com/BurntSushi/ripgrep/pull/2409):38 Added installation instructions for `winget`.39* [FEATURE #2643](https://github.com/BurntSushi/ripgrep/issues/2643):40 Make `-d` a short flag for `--max-depth`.4142Bug fixes:4344* [BUG #884](https://github.com/BurntSushi/ripgrep/issues/884):
1518 unmodified lines