Skip to content

Search in parent folders for commit.json config file #42

Closed
@alt-art

Description

@alt-art

The current implementation only searches the config file in pwd, home folder and argument, But git and other tools as the capability of searching config files and folders in parent folders in case someone move out of the config file folder.

Note: This will need a depth value for stop at a given iteration

Function that will handle this:

commit/src/config/mod.rs

Lines 81 to 92 in ac7cfe0

fn get_config_path() -> Result<PathBuf> {
let current_dir = std::env::current_dir()?;
let current_file = current_dir.join("commit.json");
if current_file.is_file() {
Ok(current_file)
} else {
let config_file = dirs::config_dir()
.ok_or_else(|| anyhow!("Could not find config directory"))?
.join("commit/commit.json");
Ok(config_file)
}
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions