(724dc03) Add -o <owner> flag to comment subcommand
This commit is contained in:
@@ -77,5 +77,9 @@ pub enum Command {
|
||||
|
||||
/// Comment body (required)
|
||||
body: String,
|
||||
|
||||
/// Owner
|
||||
#[arg(short, long)]
|
||||
owner: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
+5
-2
@@ -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
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user