From a0c592ff81335202b59c405eeed11bf92bf0aa5b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 14 May 2021 14:02:58 -0500 Subject: [PATCH 1/2] feat(cli): Provide traceability on config loading --- src/config.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.rs b/src/config.rs index 305e794..8a7453c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,6 +17,7 @@ impl Config { let config = if let Some(path) = find_project_file(cwd, &["typos.toml", "_typos.toml", ".typos.toml"]) { + log::debug!("Loading {}", path.display()); Some(Self::from_file(&path)?) } else { None From 1a1ff20f40601bfddee1c668e337201045779c4a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 14 May 2021 14:06:15 -0500 Subject: [PATCH 2/2] fix(cli): Discover config in parent dirs My only guess is that in a76ddd42, I lost track of different parts of my change and never re-implemented this logic. --- src/policy.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/policy.rs b/src/policy.rs index 020eeb0..1115c72 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -123,8 +123,11 @@ impl<'s> ConfigEngine<'s> { let mut config = crate::config::Config::default(); if !self.isolated { - if let Some(derived) = crate::config::Config::from_dir(cwd)? { - config.update(&derived); + for ancestor in cwd.ancestors() { + if let Some(derived) = crate::config::Config::from_dir(ancestor)? { + config.update(&derived); + break; + } } } if let Some(overrides) = self.overrides.as_ref() {