File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,7 @@ pub fn run(mut args: Opt) -> Result<()> {
405
405
}
406
406
}
407
407
408
- // Parse the configuration file.
408
+ // Set path for the configuration file.
409
409
let mut path = args. config . clone ( ) ;
410
410
if !path. exists ( ) {
411
411
if let Some ( config_path) = dirs:: config_dir ( )
@@ -415,6 +415,7 @@ pub fn run(mut args: Opt) -> Result<()> {
415
415
}
416
416
}
417
417
418
+ // Parse the configuration file.
418
419
// Load the default configuration if necessary.
419
420
let mut config = if let Ok ( ( config, name) ) = builtin_config {
420
421
info ! ( "Using built-in configuration file: {name}" ) ;
@@ -423,6 +424,20 @@ pub fn run(mut args: Opt) -> Result<()> {
423
424
Config :: parse ( & path) ?
424
425
} else if let Some ( contents) = Config :: read_from_manifest ( ) ? {
425
426
Config :: parse_from_str ( & contents) ?
427
+ } else if let Some ( discovered_path) =
428
+ env:: current_dir ( ) ?. ancestors ( ) . find_map ( |dir| {
429
+ let path = dir. join ( DEFAULT_CONFIG ) ;
430
+ if path. is_file ( ) {
431
+ Some ( path)
432
+ } else {
433
+ None
434
+ }
435
+ } ) {
436
+ info ! (
437
+ "Using configuration from parent directory: {}" ,
438
+ discovered_path. display( )
439
+ ) ;
440
+ Config :: parse ( & discovered_path) ?
426
441
} else {
427
442
if !args. context {
428
443
warn ! (
You can’t perform that action at this time.
0 commit comments