Skip to content

Commit

Permalink
feat: ✨ Add Display trait for Author structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AntwortEinesLebens committed Jan 16, 2025
1 parent e5a08de commit 670f316
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ struct Author {
email: Option<String>,
}

impl Display for Author {
fn fmt(&self, formatter: &mut Formatter) -> FormatResult {
let mut email_line: String = String::default();

if let Some(email) = &self.email {
email_line = format!("\nEmail: {}", email);
}

write!(
formatter,
"Name: {}\
{}",
self.name, email_line
)
}
}

#[derive(Parser)]
pub struct Generate {
#[clap(required = true, help = "Path to the generation file")]
Expand Down

0 comments on commit 670f316

Please sign in to comment.