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

Method parse_author

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

Parse the author string into an Author struct.

(&self)

Source from the content-addressed store, hash-verified

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

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