Initial commit: git-issue-commit CLI tool
Some checks failed
CI / test (push) Has been cancelled
CI / release (push) Has been cancelled

This commit is contained in:
2026-01-29 19:59:27 +00:00
parent 49a8c948f0
commit 4199a71e6f

View File

@@ -0,0 +1,36 @@
use serde::Serialize;
#[derive(Debug, Clone, Default)]
pub struct ConventionalMessage {
pub r#type: String,
pub scope: Option<String>,
pub description: String,
pub body: Option<String>,
pub breaking: bool,
pub breaking_description: Option<String>,
pub footer: Option<String>,
}
impl ConventionalMessage {
pub fn header(&self) -> String {
let scope_part = self.scope.as_ref()
.map(|s| format!("({})", s))
.unwrap_or_default();
let breaking_marker = if self.breaking { "!" } else { "" };
let description = if self.description.trim().is_empty() {
"no description".to_string()
} else {
self.description.clone()
};
format!(
"{}{}{}: {}",
self.r#type,
scope_part,
breaking_marker,
description
)
}
}