hive-forge: show + post/remove emoji reactions on issues, PRs, and comments

This commit is contained in:
damocles 2026-08-18 12:37:52 +02:00 committed by mara
commit 2c45a9960f
9 changed files with 261 additions and 13 deletions

View file

@ -6,7 +6,9 @@ use clap::Args as ClapArgs;
use serde_json::json;
use crate::client::{Client, index};
use crate::verbs::{attachment_json, attachment_line, print_json, rfc3339};
use crate::verbs::{
attachment_json, attachment_line, comment_reactions, print_json, reaction_summary, rfc3339,
};
#[derive(ClapArgs)]
pub struct Args {
@ -23,6 +25,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
else {
bail!("hive-forge comment-show: comment {} not found", args.id);
};
let reactions = comment_reactions(client, owner, name, args.id)?;
if client.json_mode() {
let trimmed = json!({
"id": c.id,
@ -32,6 +35,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
"body": c.body,
"url": c.html_url,
"attachments": attachment_json(c.assets.as_deref()),
"reactions": reactions,
});
print_json(&trimmed)
} else {
@ -42,6 +46,9 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
println!("{line}");
}
}
if let Some(summary) = reaction_summary(&reactions) {
println!("[reactions: {summary}]");
}
Ok(())
}
}