From d8027c23dbcc9313a3de1975b32f60ab7553dfab Mon Sep 17 00:00:00 2001 From: steven-omaha <35634100+steven-omaha@users.noreply.github.com> Date: Fri, 6 Jan 2023 14:18:10 +0100 Subject: [PATCH] fix section extraction from group file --- src/section.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/section.rs b/src/section.rs index 57cba43..bd4fc18 100644 --- a/src/section.rs +++ b/src/section.rs @@ -14,7 +14,14 @@ impl Section { } pub fn from_lines<'a>(iter: &mut impl Iterator) -> 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 .take_while(|line| !line.starts_with('[')) .filter(|line| !line.contains(char::is_alphabetic))