hive-forge: surface comment/issue attachments in comments/view/comment-show/issue
This commit is contained in:
parent
ecf9ff4d80
commit
6f3ac755e0
5 changed files with 93 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ use clap::Args as ClapArgs;
|
|||
use serde_json::json;
|
||||
|
||||
use crate::client::{Client, index};
|
||||
use crate::verbs::{print_json, rfc3339};
|
||||
use crate::verbs::{attachment_json, attachment_line, print_json, rfc3339};
|
||||
|
||||
#[derive(ClapArgs)]
|
||||
pub struct Args {
|
||||
|
|
@ -31,11 +31,17 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
"updated_at": rfc3339(c.updated_at),
|
||||
"body": c.body,
|
||||
"url": c.html_url,
|
||||
"attachments": attachment_json(c.assets.as_deref()),
|
||||
});
|
||||
print_json(&trimmed)
|
||||
} else {
|
||||
let body = c.body.as_deref().unwrap_or("");
|
||||
println!("{body}");
|
||||
for a in c.assets.as_deref().unwrap_or_default() {
|
||||
if let Some(line) = attachment_line(a) {
|
||||
println!("{line}");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue