Watch
0
0
Fork
You've already forked hyperhive
0

hive-forge: dedup the --json refusal into refuse_json(), test it, cover attachment-get/artifact-get too

This commit is contained in:
damocles 2026-10-04 08:10:43 +02:00
commit e18497bb70
8 changed files with 58 additions and 27 deletions

View file

@ -14,6 +14,7 @@ use anyhow::{Result, bail};
use clap::Args as ClapArgs;
use crate::client::Client;
use crate::verbs::refuse_json;
#[derive(ClapArgs)]
pub struct Args {
@ -34,6 +35,11 @@ pub struct Args {
/// the input, if the download fails (network, 4xx/5xx), or if the
/// output path cannot be written.
pub fn run(client: &Client, args: Args) -> Result<()> {
refuse_json(
client.json_mode(),
"attachment-get",
"it downloads the raw attachment bytes, there is no JSON form",
)?;
let uuid = extract_uuid(&args.attachment)?;
let url = client.attachment_url(&uuid);
let bytes = client.get_bytes_raw(&url)?;