(724dc03) Add -o <owner> flag to comment subcommand

This commit is contained in:
2026-05-15 16:32:03 +02:00
parent 443586a583
commit dd5692d0a3
4 changed files with 58 additions and 3 deletions
+4
View File
@@ -77,5 +77,9 @@ pub enum Command {
/// Comment body (required)
body: String,
/// Owner
#[arg(short, long)]
owner: Option<String>,
},
}
+5 -2
View File
@@ -351,7 +351,7 @@ pub fn cmd_mv(ticket_id: &str, target_status: &str, force: bool, start: &Path) -
Ok(())
}
pub fn cmd_comment(ticket_id: &str, body: &str, start: &Path) -> Result<()> {
pub fn cmd_comment(ticket_id: &str, body: &str, owner: &Option<String>, start: &Path) -> Result<()> {
if body.is_empty() {
return Err(anyhow!("Comment body is required."));
}
@@ -371,7 +371,10 @@ pub fn cmd_comment(ticket_id: &str, body: &str, start: &Path) -> Result<()> {
let filename = format!("{}.md", timestamp);
let filepath = comments_dir.join(&filename);
let author = get_git_user().unwrap_or_else(|| "unknown".to_string());
let author = match owner {
Some(o) => o.clone(),
None => get_git_user().unwrap_or_else(|| "unknown".to_string()),
};
let comment_content = format!(
"**Comment**\n\
+1 -1
View File
@@ -47,6 +47,6 @@ fn main() -> Result<()> {
status,
force,
} => cmd_mv(&ticket, &status, force, &start),
Command::Comment { ticket, body } => cmd_comment(&ticket, &body, &start),
Command::Comment { ticket, body, owner } => cmd_comment(&ticket, &body, &owner, &start),
}
}