fix section extraction from group file

This commit is contained in:
timeshifter
2023-01-06 14:18:10 +01:00
parent 0ed6359293
commit 098ab765b3
+8 -1
View File
@@ -14,7 +14,14 @@ impl Section {
} }
pub fn from_lines<'a>(iter: &mut impl Iterator<Item = &'a str>) -> Self { pub fn from_lines<'a>(iter: &mut impl Iterator<Item = &'a str>) -> Self {
let name = iter.find(|line| line.starts_with('[')).unwrap().to_string(); let name = iter
.find(|line| line.starts_with('['))
.unwrap()
.trim()
.trim_start_matches('[')
.trim_end_matches(']')
.to_string();
let packages = iter let packages = iter
.take_while(|line| !line.starts_with('[')) .take_while(|line| !line.starts_with('['))
.filter(|line| !line.contains(char::is_alphabetic)) .filter(|line| !line.contains(char::is_alphabetic))