@@ -26,6 +26,8 @@ struct FdOptions {
2626 max_depth : usize
2727}
2828
29+ const MAX_DEPTH_DEFAULT : usize = 25 ;
30+
2931/// Print a search result to the console.
3032fn print_entry ( entry : & DirEntry , path_rel : & Path , config : & FdOptions ) {
3133 let path_str = match path_rel. to_str ( ) {
@@ -104,16 +106,17 @@ fn main() {
104106 opts. optflag ( "" , "hidden" ,
105107 "search hidden files/directories (default: off)" ) ;
106108 opts. optflag ( "F" , "follow" , "follow symlinks (default: off)" ) ;
107- opts. optflag ( "n" , "no-color" , "do not colorize output" ) ;
108- opts. optopt ( "d" , "max-depth" , "maximum search depth" , "DEPTH" ) ;
109+ opts. optflag ( "n" , "no-color" , "do not colorize output (default: on)" ) ;
110+ opts. optopt ( "d" , "max-depth" ,
111+ "maximum search depth (default: 25)" , "D" ) ;
109112
110113 let matches = match opts. parse ( & args[ 1 ..] ) {
111114 Ok ( m) => m,
112115 Err ( e) => error ( e. description ( ) )
113116 } ;
114117
115118 if matches. opt_present ( "h" ) {
116- let brief = "Usage: fd [PATTERN]" ;
119+ let brief = "Usage: fd [options] [ PATTERN]" ;
117120 print ! ( "{}" , opts. usage( & brief) ) ;
118121 process:: exit ( 1 ) ;
119122 }
@@ -141,7 +144,7 @@ fn main() {
141144 max_depth :
142145 matches. opt_str ( "max-depth" )
143146 . and_then ( |ds| usize:: from_str_radix ( & ds, 10 ) . ok ( ) )
144- . unwrap_or ( 25 )
147+ . unwrap_or ( MAX_DEPTH_DEFAULT )
145148 } ;
146149
147150 match RegexBuilder :: new ( pattern)
0 commit comments