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

Method parse_author

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

Parse the author string into an Author struct.

(&self)

Source from the content-addressed store, hash-verified

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

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