Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alt-art opened this issue Oct 2, 2023 · 1 comment · Fixed by #50
Closed

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

alt-art opened this issue Oct 2, 2023 · 1 comment · Fixed by #50
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Issues designed for hacktoberfest

Comments

@alt-art
Copy link
Owner

alt-art commented Oct 2, 2023

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)
}
}

@alt-art alt-art added the good first issue Good for newcomers label Oct 2, 2023
@alt-art alt-art added hacktoberfest Issues designed for hacktoberfest enhancement New feature or request labels Oct 3, 2023
@letsaguiar letsaguiar removed their assignment Oct 10, 2023
Repository owner deleted a comment from letsaguiar Oct 10, 2023
@PrathameshTheurkar
Copy link

hey @alt-art can you assign this issue to me plz . I would love to contribute to this issue .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Issues designed for hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants