Add support for .yaml extension alongside .yml#77
Conversation
| return Err(ConfigError::Message(format!( | ||
| "Unsupported configuration file format '.{}'. Only {} files are supported.", | ||
| extension, | ||
| CONFIG_FILE_EXTENSIONS.join(" and ") |
There was a problem hiding this comment.
you might want to change and to or in this line 🤔
There was a problem hiding this comment.
Thanks for the suggestion! Changed and to or as recommended.
1e4e1ff
f1e87f1 to
1e4e1ff
Compare
dora1998
left a comment
There was a problem hiding this comment.
I posted a few comments, but it's up to you. Thanks!
| let config_file_path = match self.config_file_path { | ||
| Some(path) => { | ||
| let has_valid_extension = | ||
| CONFIG_FILE_EXTENSIONS.iter().any(|ext| path.ends_with(ext)); |
There was a problem hiding this comment.
imo. When specifying the -c option, I believe there's no need to check the file extension. This is sufficient since exceptions during deserialization are already handled in the subsequent load_config process.
There was a problem hiding this comment.
ok , removed this validation for explicit -c paths and let load_config handle any format issues once
| fn init_prompt() -> Result<InitPromptResult, Error> { | ||
| // TODO: Add support for finding root of the project | ||
| let is_config_file_exists = std::path::Path::new(DEFAULT_CONFIG_FILE_PATH).exists(); | ||
| let existing_configs: Vec<&str> = DEFAULT_CONFIG_FILE_PATHS |
There was a problem hiding this comment.
imo. If the ConfigBuilder can check for the existence of the config file, we might not have to worry about variations in the YAML file extension when implementing the init command. 💭
There was a problem hiding this comment.
Agreed on the shared logic. changed to move it to ConfigBuilder by e1d3198 (is this what you were suggesting?
There was a problem hiding this comment.
Yes, that's what I expected. Thanks!
Summary
#76
Added support for
.yamlextension in addition to the existing.ymlsupport. The tool now accepts both formats, with.yamltaking precedence when both exist.Changes
.yamland.ymlconfiguration files