MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_author

Method parse_author

atomic-cli/src/commands/record/builder.rs:46–59  ·  view source on GitHub ↗

Parse the author string into an Author struct.

(&self)

Source from the content-addressed store, hash-verified

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 ///

Callers 5

test_parse_author_fullFunction · 0.45
test_parse_author_noneFunction · 0.45
resolve_authorMethod · 0.45

Calls 1

as_refMethod · 0.80

Tested by 4

test_parse_author_fullFunction · 0.36
test_parse_author_noneFunction · 0.36