Support automatic config loading via toml file#48
Support automatic config loading via toml file#48iamriel wants to merge 10 commits intodisrupted:mainfrom
Conversation
This will enable us to connect to daemonized blackd running in 0.0.0.0
|
Hello, thank you for this package as it's improved my workflow a lot. I have forked the repository and made some changes (not sure if it's an improvement though) I am not an expert in rust so I won't lie and I did use the help of chatgpt in some of the code changes. I am not expecting that my changes will go to your repository but I just want someone to check the implementation I made and of course accept feedback and suggestions for me to learn more. Also, I haven't read some contributing guides in the code so forgive me if this method is not appropriate. Thanks a lot! |
|
Hi @iamriel, I am happy to give this a thorough look, hopefully very soon. Could you meanwhile take a look at the CI run and fix the clippy diagnostics? |
|
@disrupted Absolutely, I forgot to install pre commit hooks, sorry about that. I have pushed an update in this commit. Thanks! |
|
Really like this feature! |
src/config.rs
Outdated
| let mut path = env::current_dir().unwrap(); | ||
| let target_file_name = target_file_name.unwrap_or("pyproject.toml"); | ||
|
|
||
| while path.pop() { |
There was a problem hiding this comment.
This will pop current dir before check.
For example, I have config in my current dir /project/name/pyproject.toml
In this case first check will be on /project/pyproject.toml
This works ok
loop {
let potential_config_path = path.join(target_file_name);
if potential_config_path.is_file() {
return Config::from_file(potential_config_path)
.expect("Failed to load config file");
}
match path.pop() {
true => (),
false => return Config { tool: None },
}
}There was a problem hiding this comment.
@mrparalon Thanks for the feedback. I have pushed an update in this commit.
These are the main changes covered in this Pull Request: