Colorize the output!

This commit is contained in:
2025-07-02 22:06:36 -05:00
parent ea046c929f
commit b82cfdb822
2 changed files with 16 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
use std::fmt::Display;
use colored::Colorize;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
@@ -23,23 +24,29 @@ pub struct Release {
impl Display for Release {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let tag = "Tag:".green().bold();
let name = "Name:".green();
let published = "Published:".bright_green();
let created = "Created:".green().dimmed();
let author = "Author:".blue();
let body = if self.body.len() > 0 {
&self.body
&self.body.white()
} else {
&String::from("(empty body)")
&String::from("(empty body)").dimmed()
};
write!(f,
"Tag: {}
Name: {}
"{tag} {}
{name} {}
{}
Published: {} (created: {})
Author: {} ({})
{published} {} ({created} {})
{author} {} ({})
",
self.tag_name,
self.tag_name.bold(),
self.name,
body,
self.published_at,
self.created_at,
self.created_at.dimmed(),
self.author.login,
self.author.email,
)