Skip to content

Commit

Permalink
feat: ✨ Add emojis and colors
Browse files Browse the repository at this point in the history
  • Loading branch information
AntwortEinesLebens committed Jan 29, 2025
1 parent 5c74ea0 commit adb262d
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::commands::{
Runnable,
};
use clap::Parser;
use console::{style, Emoji};
use serde::Deserialize;
use std::{
fmt::{Display, Formatter, Result as FormatResult},
Expand Down Expand Up @@ -51,8 +52,9 @@ impl Display for Metadata {
for (index, author) in authors.iter().enumerate() {
authors_lines.push_str(
format!(
"Author n°{}\n\
"{}Author n°{}\n\
{}",
Emoji("🧑 ", ""),
index + 1,
author
)
Expand All @@ -67,12 +69,17 @@ impl Display for Metadata {

write!(
formatter,
"Metadata\n\
Name: {}\n\
Version: {}\n\
References: {:#?}\n\n\
"{}Name: {}\n\
{}Version: {}\n\
{}References: {:#?}\n\n\
{}",
self.name, self.version, self.references, authors_lines
Emoji("📝 ", ""),
self.name,
Emoji("🤖 ", ""),
self.version,
Emoji("🔗 ", ""),
self.references,
authors_lines
)
}
}
Expand All @@ -82,14 +89,16 @@ impl Display for Author {
let mut email_line: String = String::default();

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

write!(
formatter,
"Name: {}\
"{}Name: {}\
{}",
self.name, email_line
Emoji("💬 ", ""),
self.name,
email_line
)
}
}
Expand All @@ -112,15 +121,20 @@ impl Runnable for Generate {
return ExitCode::FAILURE;
};

println!("{}", generation.metadata);
println!(
"Generation metadata\n\
{}",
generation.metadata
);

for (index, command) in generation.commands.iter().enumerate() {
let trace: &dyn Trace = command.traverse();

println!(
"\n[{}/{}] Generating {} trace",
index + 1,
generation.commands.len(),
"\n{} Generating {} trace",
style(format!("[{}/{}]", index + 1, generation.commands.len()))
.blue()
.bold(),
trace.name(),
);

Expand Down

0 comments on commit adb262d

Please sign in to comment.