Parse the author string into an Author struct.
(&self)
| 44 | |
| 45 | /// Parse the author string into an Author struct. |
| 46 | pub(super) fn parse_author(&self) -> Option<Author> { |
| 47 | self.author.as_ref().map(|s| { |
| 48 | // Try to parse "Name <email>" format |
| 49 | if let Some(bracket_start) = s.find('<') { |
| 50 | if let Some(bracket_end) = s.find('>') { |
| 51 | let name = s[..bracket_start].trim(); |
| 52 | let email = s[bracket_start + 1..bracket_end].trim(); |
| 53 | return Author::new(name, Some(email)); |
| 54 | } |
| 55 | } |
| 56 | // Just a name |
| 57 | Author::new(s.trim(), None::<&str>) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | /// Get the author from identity store or command-line override. |
| 62 | /// |