feat: handle comments on end of line

This commit is contained in:
Vladimir Rubin 2024-12-30 19:01:56 +02:00
parent 2fed2c8223
commit e1279517a9
Signed by: vavakado
GPG key ID: CAB744727F36B524

View file

@ -48,8 +48,8 @@ impl Config {
.filter(|l| !l.is_empty())
.filter(|l| !l.starts_with('#'))
{
if line.starts_with('[') && line.ends_with(']') {
current_section = line[1..line.len() - 1].to_string();
if line.starts_with('[') && line.contains(']') {
current_section = line[1..line.find(']').unwrap()].to_string();
} else if let Some((key, value)) = line.split_once('=') {
let key_trimmed_string = key.trim().replace('"', "");
let key_trimmed = key_trimmed_string.as_str();