feat: eliminating comments in config

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-11-20 00:20:40 +03:00
parent 608f91c381
commit 6be3a7f5c6

View file

@ -89,13 +89,17 @@ impl Input {
reader
.lines()
.map(|unchecked_line| unchecked_line.unwrap())
.filter(|unwrapped_line| !unwrapped_line.starts_with('#'))
.map(|mut line|{
if let Some(comment_location) = line.find('#') {
let _ = line.split_off(comment_location);
}
line
})
.for_each(|line| {
lines.append(
&mut line
.split('=')
.map(|splitted| splitted.trim().to_string())
.filter(|trimmed| !trimmed.starts_with('#'))
.collect::<Vec<String>>(),
)
});