Update src/config/container.rs

Co-authored-by: epi <43392618+epi052@users.noreply.github.com>
This commit is contained in:
Andrea De Murtas
2023-09-10 18:28:42 +02:00
committed by GitHub
parent 83f90529e9
commit 564686bc5a

View File

@@ -659,8 +659,17 @@ impl Configuration {
for ext in arg {
if let Some(stripped) = ext.strip_prefix('@') {
let contents = read_to_string(stripped).unwrap_or_else(|e| report_and_exit(&e.to_string()));
extensions.extend(extensions_string.split('\n').map(|s| s.trim_start_matches('.').trim().to_string()));
extensions = extensions.into_iter().filter(|s| !s.is_empty()).collect();
let exts_from_file = contents.split('\n').filter_map(|s| {
let trimmed = s.trim().trim_start_matches('.');
if trimmed.is_empty() || trimmed.starts_with('#') {
None
} else {
Some(trimmed.to_string())
}
});
extensions.extend(exts_from_file);
} else {
extensions.push(ext.trim_start_matches('.').to_string());
}