diff --git a/src/bin/git-edit-coauthor.rs b/src/bin/git-edit-coauthor.rs index 22491a5..60d2388 100644 --- a/src/bin/git-edit-coauthor.rs +++ b/src/bin/git-edit-coauthor.rs @@ -20,24 +20,22 @@ fn main() { let opt = Opt::parse(); let mut authors = get_available_coauthors(); - let mut updated_author: Author; if let Some(author) = authors.get(&opt.initials) { - updated_author = author.clone(); + let mut updated_author: Author = author.clone(); + if let Some(name) = opt.name { + updated_author.name = name; + }; + + if let Some(email) = opt.email { + updated_author.email = email; + }; + + authors.insert(opt.initials, updated_author); + + write_coauthors_file(authors); } else { eprintln!("No author found with initials {}", &opt.initials); process::exit(1); - } - - if let Some(name) = opt.name { - updated_author.name = name; - } - - if let Some(email) = opt.email { - updated_author.email = email; - } - - authors.insert(opt.initials, updated_author); - - write_coauthors_file(authors); + }; }