Merge pull request #247 from epage/search

fix(cli): Discover config in parent dirs
This commit is contained in:
Ed Page 2021-05-14 18:55:13 -05:00 committed by GitHub
commit 7c6b85c442
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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)? {
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() {