start adding support for comments on issues #9

Merged
seb merged 4 commits from comments into main 2025-07-07 22:35:33 -06:00
Showing only changes of commit 8ac4ca4c54 - Show all commits

View file

@ -39,6 +39,12 @@ enum Commands {
issue_id: String,
new_state: Option<State>,
},
/// Create a new comment on an issue.
Comment {
issue_id: String,
description: Option<String>,
},
}
fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<()> {
@ -128,6 +134,27 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
}
}
}
Commands::Comment {
issue_id,
description,
} => {
let mut issues =
entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?;
let Some(issue) = issues.get_mut_issue(issue_id) else {
return Err(anyhow::anyhow!("issue {} not found", issue_id));
};
println!("found issue {}", issue.title());

can we make this a log::debug!()?

can we make this a `log::debug!()`?

I took it out entirely, that debug message no longer sparks joy.

I took it out entirely, that debug message no longer sparks joy.
let mut comment = issue.new_comment()?;
match description {
Some(description) => {
comment.set_description(description)?;
}
None => {
comment.edit_description()?;
}
}
}
}
Ok(())