From 5bde3513e6b7046f6f33591d479f337260a4c6cf Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sun, 14 May 2017 17:19:45 +0200 Subject: [PATCH] Document recursion depth --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 7a4ee8e..6ccf6a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use isatty::stdout_isatty; use regex::{Regex, RegexBuilder}; use walkdir::{WalkDir, DirEntry, WalkDirIterator}; +/// Configuration options for *fd*. struct FdOptions { case_sensitive: bool, search_full_path: bool, @@ -26,6 +27,7 @@ struct FdOptions { max_depth: usize } +/// The default maximum recursion depth. const MAX_DEPTH_DEFAULT : usize = 25; /// Print a search result to the console. @@ -108,7 +110,9 @@ fn main() { opts.optflag("F", "follow", "follow symlinks (default: off)"); opts.optflag("n", "no-color", "do not colorize output (default: on)"); opts.optopt("d", "max-depth", - "maximum search depth (default: 25)", "D"); + format!("maximum search depth (default: {})", + MAX_DEPTH_DEFAULT).as_str(), + "D"); let matches = match opts.parse(&args[1..]) { Ok(m) => m,